void * compatibility
Henry Spencer
henry at zoo.toronto.edu
Sun Sep 23 10:24:28 AEST 1990
In article <26628 at mimsy.umd.edu> chris at mimsy.umd.edu (Chris Torek) writes:
>Personally, I think defining NULL as (void *)0 is foolishness: if you
>want your compiler to provide complete error checking, you should define
>it as `__nil' and make __nil a keyword. Using (void *)0 fixes a few
>specific problems, but leaves others unfixed and unfixable.
Actually, the Rationale for ANSI C makes it clear that error checking had
nothing to do with making `(void *)0' an official null pointer. The
motive was to provide for a NULL of the same size as most pointers --
thereby minimizing breakage of old defective code -- on machines where
there is no integer type of the right size. Minimizing breakage is also
the reason why (e.g.) `0L' is also a legal NULL, for machines where
pointers are the size of longs rather than ints.
--
TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology
OSI: handling yesterday's loads someday| henry at zoo.toronto.edu utzoo!henry
More information about the Comp.lang.c
mailing list