server/fd.c: Prevent using uninitialized pointers

Frédéric Delanoy frederic.delanoy at gmail.com
Sat Jul 4 19:32:28 CDT 2009


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 initialized to 0. In your
>> example you show regular variables only. Their initial value is not defined.
>>
>>
>>   
> Correct.  I was making the assumption that the discussion was not about
> static variables.  Static variables are always initialized:
> 
> static int a;
> 
> will be zero
> 
> static char b;
> 
> will be NULL

or, more precisely (pedantically) NUL or '\0' (which just happens to be the same as NULL [all bits set to 0] on most (all?) architectures IIRC) 

Frédéric



More information about the wine-devel mailing list