NULL is not '\0' (was: Is malloc() or calloc() "better"?)

Jean-Pierre Radley jpr at dasys1.UUCP
Fri Jan 27 06:39:46 AEST 1989


In article <11375 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
>Right idea, wrong name.  NULL is a null pointer constant.  Please do not
>confuse it with the null character.  If the built-in name '\0' isn't good
>enough, then call it NUL (with one L, as in the ASCII tables).
>For nearly accidental reasons, it is quite legal% to write '\0' when you mean
>a null pointer constant, though only an Obfuscated C contestant would do so.
>Using NULL when you mean a null character, however, is not guaranteed to work
>(even with the cast), since (in ANSI C) the macro might expand into (void *)0.

Well, I just wasted a lot of time with one my programs because of the
following:

On the Tandy 6000, the stdio.h file says:
	#define NULL	0

But I just switched to a Tandy 4000, and the SCO 2.2.4 Xenix stdio.h says:
	#define NULL	(char *)0

"... standards, because there are so many ..."
-- 
Jean-Pierre Radley		Honi soit		jpr at dasys1.UUCP
New York, New York		qui mal			...!hombre!jpradley!jpr
CIS: 76120,1341			y pense			...!hombre!trigere!jpr



More information about the Comp.lang.c mailing list