[net.unix-wizards] NULL problems

faustus@ucbcad.UUCP (Wayne A. Christopher) (05/14/85)

Can anybody think of any problems with making "NULL" a part of the C
language, specifically as a pointer to anything with a value of 0? As
has been pointed out, it is a pain to have to remember to cast it all
the time, and I tend to think of NULL as a pointer, not an integer.
Perhaps then if anybody wanted to change NULL to be some other value,
for instance if he wanted *NULL to be invalid, then the compiler could
be changed to make NULL behave like 0 in things like "while (p)" which
should mean "while (p != NULL)"...

	Wayne

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (05/15/85)

> Can anybody think of any problems with making "NULL" a part of the C
> language, specifically as a pointer to anything with a value of 0? As
> has been pointed out, it is a pain to have to remember to cast it all
> the time, and I tend to think of NULL as a pointer, not an integer.

Pointer to WHAT????  That is the whole point (n.p.i.) of casting NULL
when using it as an argument to a function.  (You don't need to cast
it for nearly any other use.)  The ANSI solution to the general
argument coercion issue will work for 0 just as well.

Shouldn't this discussion be in net.lang.c (a.k.a. INFO-C)?