Re: [go-nuts] what does p stand for in io.Reader.Read argument

2019-04-06 Thread Santhosh T
now it makes sense. thanks Santhosh On Sat, Apr 6, 2019 at 11:20 PM andrey mirtchovski wrote: > It may help to note that in the earliest references to the Read > interface in the history of the language it accepted a *[]byte, hence > 'p' may indeed stand for pointer. > > > https://github.com/go

Re: [go-nuts] what does p stand for in io.Reader.Read argument

2019-04-06 Thread andrey mirtchovski
It may help to note that in the earliest references to the Read interface in the history of the language it accepted a *[]byte, hence 'p' may indeed stand for pointer. https://github.com/golang/go/commit/7c9e2c2b6c2e0aa3090dbd5183809e1b2f53359b#diff-bf734f53a84f388bf39699d291b06b1d -- You receiv

Re: [go-nuts] what does p stand for in io.Reader.Read argument

2019-04-06 Thread Santhosh T
ok. got it my thinking is 'b' is obvious choice, then why invent new name 'p' ? On Sat, Apr 6, 2019 at 11:15 PM Jan Mercl <0xj...@gmail.com> wrote: > It can be whatever you like: passedBuf, payload, putBuffer, param, > pointer, ... > > It does not have to represent any word after all. Naming is

Re: [go-nuts] what does p stand for in io.Reader.Read argument

2019-04-06 Thread Jan Mercl
It can be whatever you like: passedBuf, payload, putBuffer, param, pointer, ... It does not have to represent any word after all. Naming is hard, but in the case of a single argument it does not matter that much, so it could be just a case of author's C habits: void *p for buffers. On Sat, Apr 6,

Re: [go-nuts] what does p stand for in io.Reader.Read argument

2019-04-06 Thread Santhosh T
seems my question is not clear. my question is regarding naming of variables. i know that single name variables in go is idiomatic. r for reader w for writer etc... Read(p []byte) (n int, err error) i dont get why argument is named 'p' instead of 'b'. there should be some reasoning. I dont get w

Re: [go-nuts] what does p stand for in io.Reader.Read argument

2019-04-06 Thread Philip Chapman
p is the array of bytes that you want to fill with data read. The method returns the count of the number of bytes read which may be any value from zero to p's length. You must make multiple reads if the thing being read from holds more data than your buffer array can hold. On Sat, Apr 6, 2019 at

[go-nuts] what does p stand for in io.Reader.Read argument

2019-04-06 Thread Santhosh T
Hi, method in io.Reader interface is: Read(p []byte) (n int, err error) what does `p` stands for ? thanks Santhosh -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an em