Must a NULL pointer be a 0 bit patte

jim at ISM780B.UUCP jim at ISM780B.UUCP
Sun Nov 4 03:28:29 AEST 1984


>/* Written 12:37 pm  Oct 22, 1984 by ron at brl-tgr in ISM780B:net.lang.c */
>> It seems to me that K&R guarantees that globals are initialized to zero,
>> not to a nil pointer.  A lot of code will bite the dust given a machine
>> with a non-zero nil pointer.
>>
>> -- Jim Balter, INTERACTIVE Systems (ima!jim)
>
>BUT that still doesn't make it legal to 0-> something.
>
>-Ron

I just love those non-sequiturs.  In case you hadn't noticed, *this*
discussion is about whether NULL can be non-zero.

Aside from the case of BSS initialization, which one could argue is equivalent
to an assignment so the compiler can handle pointers by initializing them
(good luck to people who depend on these variables really going into .bss),
there is calloc and memset(&structure, '\0', sizeof structure); these
would have to be changed to explicit member-by-member assignment,
or assignment from a dummy previously initialized structure.
Of course, the standards committee could always get carried away and add
initializers as valid structure constants, like many *modern* languages.

-- Jim Balter, INTERACTIVE Systems (ima!jim)



More information about the Comp.lang.c mailing list