Let's define our own NULL

kenny at uiucdcsm.UUCP kenny at uiucdcsm.UUCP
Fri Jun 24 02:52:00 AEST 1988


/* Written  1:55 pm  Jun 22, 1988 by mark at navtech.uucp in uiucdcsm:comp.lang.c */
/* ---------- "Let's define our own NULL" ---------- */
		#ifndef NULL
		#define NULL	0
		#endif

	That way, if someone needs NULL but doesn't need to use the standard
	I/O library, he won't need to pull in <stdio.h>."

/* End of text from uiucdcsm:comp.lang.c */

The ANSI C committee recognized that things like NULL are not part of
`standard I/O', and moved NULL to <stddef.h>, instead of <stdio.h>.
ptrdiff_t and size_t are there, too.

This solution preserves the advantage of having it in a standard
header file, so the user doesn't redefine it wrongly, but removes the
temptation to `just define it myself since I don't need standard I/O.'



More information about the Comp.lang.c mailing list