Is #define NULL 0L ok?

H.MORRIS hom at hocda.UUCP
Fri Mar 16 10:49:37 AEST 1984


A "real" NULL such that one can say foo(NULL) instead of
foo((char *)NULL) with perfect assurance implies that while
compiling the line foo(NULL) the cc knows something about the
arguments declared for the function foo.  That implies in turn
that either cc snoops around for the file containing the declaration
of foo - which gives you a language with a radically different
philosophy from C, or else within the file containing `foo(NULL)'
there is a declaration of the form:
return-type foo( (char *));
 instead of what is currently allowed:
return-type foo();
 (the former describes foo's arguments; the latter doesn't).
I heard somewhere that this is being considered.
	I am not passionate about whether function definitions which
describe the argument type are a good thing.  I feel strongly that
they should be optional so as to allow functions which take
variable argument lists like printf.  But just to point out that
without such a construct, you can't have foo(NULL) work always on
all machines when argument to foo is a pointer.
Hal MOrris ...hocad!hom



More information about the Comp.lang.c mailing list