server/fd.c: Prevent using uninitialized pointers

James McKenzie jjmckenzie51 at earthlink.net
Sat Jul 4 16:22:09 CDT 2009


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

static bool c;

will be set to false (0) unless zero is defined as TRUE.

However, if you want a particular result, it is always best to
initialize the variables you are going to use.

James McKenzie





More information about the wine-devel mailing list