Header problems

Chris Torek chris at mimsy.UUCP
Fri Mar 11 04:04:34 AEST 1988


[This makes three.]
In article <121 at polygen.UUCP> pablo at polygen.uucp (Pablo Halpern) writes:
>For compilers that don't support (void *), you must have
>a compiler-specific definition of NULL:

No.

>	#define NULL 0		/* If sizeof(int) == sizeof(char *) */
> or
>	#define NULL 0L		/* if sizeof(long) == sizeof(char *) */

Either is technically legal.  The former suffices, is not machine
dependent, and is correct.

>Since the above #defines are necessarily machine (and compiler) specific,

The definition of NULL (as 0, or if you have a dpANS-conformant
compiler, as (void *)0) is not machine dependent.  What *is* machine
dependent is whether uncasted 0 in unprototyped function calls appears
to work.  Using uncasted 0L appears to work (but is nonetheless wrong)
on IBM PCs using large model compilers.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list