NULL vs 0
chris at umcp-cs.UUCP
chris at umcp-cs.UUCP
Fri Jan 20 10:29:23 AEST 1984
I have one little minor thing to say here. I don't know about those 68k
systems that have sizeof (int) == 2, sizeof (char *) == 4, but all the
stdio.h files I've seen say
#define NULL 0
(NOT #define NULL ((char *) 0)), so it won't make a bit of difference if
you write
f () { g (NULL, 1, 2); }
instead of
f () { g (0, 1, 2); }
What you must do instead is write
f () { g ((char *) NULL, 1, 2); } /* or (char *) 0 */
(assuming g expects it's first argument to be of type "char *").
I agree that it's good practise to include type casts for function
parameters; however, as a "midnight hacker" I know how easy it is to
miss these. (But I *do* use lint!) (Ever run lint on a 4.1BSD kernel
after installing CMU IPC?)
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci
UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris.umcp-cs at CSNet-Relay
More information about the Comp.unix.wizards
mailing list