NULL vs 0

Guy Harris guy at rlgvax.UUCP
Sat Feb 4 07:04:16 AEST 1984


> The problem here is with the C `bible' and with the C compilers.  NULL
> should NOT be defined in the `stdio.h' package as this assumes (de facto)
> that there is a common interpretation.  If a generic NULL is to be
> recognized it *has* to be done by the compiler, NOT the preprocessor.  Only
> the compiler has the info (if it does) to correctly interpret the `current'
> meaning of NULL.  The idea that NULL could be something simple, like 0,
> doesn't work as we have seen over the weeks.  If there is to be a generic
> NULL pointer it MUST be known to the compiler.

Unfortunately, the only way the compiler could know the proper type to
case 0/NULL to would be if there was a way to declare the types of the arguments
that a function expects; however, there is no such provision in the C
language at present.  It is being considered by the ANSI C language standard
committee.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.unix.wizards mailing list