Re: server/fd.c: Prevent using uninitialized pointers

2009-07-05 Thread Henri Verbeet
2009/7/4 Vitaliy Margolen : > Static variables are different. They are always initialized to 0. In your Yes, although perhaps it should be noted that in this particular case the static storage duration is due to these being global variables, rather than the static keyword which just specifies inter

Re: server/fd.c: Prevent using uninitialized pointers

2009-07-04 Thread Frédéric Delanoy
On 07/04/2009 11:22 PM, James McKenzie wrote: > Vitaliy Margolen wrote: >> James McKenzie wrote: >> >>> [code] >>> >>> int a = 0; >>> char b = NULL; >>> bool c = TRUE; >>> >>> [/code] >>> >>> Without this, we cannot assume anything. >>> >> Static variables are different. They are always ini

Re: server/fd.c: Prevent using uninitialized pointers

2009-07-04 Thread James McKenzie
Vitaliy Margolen wrote: > James McKenzie wrote: > >> [code] >> >> int a = 0; >> char b = NULL; >> bool c = TRUE; >> >> [/code] >> >> Without this, we cannot assume anything. >> > > Static variables are different. They are always initialized to 0. In your > example you show regular variables

Re: server/fd.c: Prevent using uninitialized pointers

2009-07-04 Thread Vitaliy Margolen
James McKenzie wrote: > [code] > > int a = 0; > char b = NULL; > bool c = TRUE; > > [/code] > > Without this, we cannot assume anything. Static variables are different. They are always initialized to 0. In your example you show regular variables only. Their initial value is not defined. Vitali

Re: server/fd.c: Prevent using uninitialized pointers

2009-07-04 Thread James McKenzie
Henri Verbeet wrote: > 2009/6/30 Daniel Santos : > >> Some pointers are getting used prior to initialization. It would appear >> that the current compilers are initializing them to zero or we've been lucky. >> >> > No, the C standard specifies that these are initialized to NULL, since > t

Re: server/fd.c: Prevent using uninitialized pointers

2009-06-30 Thread Henri Verbeet
2009/6/30 Daniel Santos : > Some pointers are getting used prior to initialization.  It would appear that > the current compilers are initializing them to zero or we've been lucky. > No, the C standard specifies that these are initialized to NULL, since they have static storage duration.

Re: server/fd.c: Prevent using uninitialized pointers

2009-06-30 Thread Matteo Bruni
I'm quite sure that C standards guarantee global variables are initialized to 0. 2009/6/30 Daniel Santos : > Some pointers are getting used prior to initialization.  It would appear that > the current compilers are initializing them to zero or we've been lucky. > > > > > >