NULL vs 0
guy at rlgvax.UUCP
guy at rlgvax.UUCP
Sat Jan 21 08:49:46 AEST 1984
Probably, nothing would break if NULL were defined as 0L in <stdio.h> on
machines with sizeof(int) == 2 and sizeof(XXX *) == 4, but 1) it would not
shut "lint" up - and when it complains that you really should cast 0 to
(char *)0, one should listen as there may be machines on which the cast
is necessary - and 2) it wouldn't help if you just used 0 instead of NULL.
Remember, NULL is just sugar over the 0; the language says 0 may be coerced
to a pointer. I've seen tons of programs which use 0 rather than NULL. The
program may not include <stdio.h>, and if every program #defined NULL as 0L
the program would no longer be portable.
Guy Harris
{seismo,ihnp4,allegra}!rlgvax!guy
More information about the Comp.unix.wizards
mailing list