Is #define NULL 0L ok?

Richard O'Keefe ok at edai.UUCP
Sat Mar 10 11:59:04 AEST 1984


One kind net.lang.c reader pointed out that Lint was JUSTIFIED
in its complaints about my passing NULL to functions expecting
a pointer argument.  What I hadn't realise was that stdio.h
defines
	#define	NULL 0
(I thought it was (char*)0.)  Now I know that there is no hope
of ever running the program I've been struggling with on a 16-
bit machine, the question is will it run on a machine with 32-
bit pointers but int=16 bits.  So I've changed my header file,
it now starts

	#include <stdio.h>
	#undef	NULL
	#define	NULL 0L

This works fine on the VAX, but then so did NULL=0.  Can any
reader with a ptr=32&int=16 C compiler tell me if this is ok
for such compilers?

PS: my request for an ALIGNOK directive to Lint had nothing
to do with *this* problem.



More information about the Comp.lang.c mailing list