[nodejs] What's the default value for buffer

2012-12-07 Thread Goddy Zhao
var buf = new Buffer[1]; console.log(buf[0]); The above code will print a random value of buf[0], anyone know why the default value of a buffer element is not 0 but a random one, and what's the rule of the value? -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joy

Re: [nodejs] What's the default value for buffer

2012-12-07 Thread Mark Hahn
I would guess the rule is that there is no rule. On Fri, Dec 7, 2012 at 6:13 PM, Goddy Zhao wrote: > var buf = new Buffer[1]; > console.log(buf[0]); > > The above code will print a random value of buf[0], anyone know why the > default value of a buffer element is not 0 but a random one, and what'

Re: [nodejs] What's the default value for buffer

2012-12-09 Thread Jorge Chamorro
memory is continually reused so it may as well contain data from any other connection. On 08/12/2012, at 06:53, Mark Hahn wrote: > I would guess the rule is that there is no rule. > > On Fri, Dec 7, 2012 at 6:13 PM, Goddy Zhao wrote: >> var buf = new Buffer[1]; >> console.log(buf[0]); >> >>