#defining NULL as (-1) in stdio

Joe Keane jgk at speech2.cs.cmu.edu
Thu Jun 23 04:25:03 AEST 1988


In article <8806221521.AA00536 at decwrl.dec.com> minow at thundr.dec.com (Martin Minow THUNDR::MINOW ML3-5/U26 223-9922) writes:
>In a recent posting, sun!gorodish!guy comments on another posting:
>>[`#define NULL (-1)' is unacceptable]

>While this is true as far as it goes, the documentation for early Unix
>systems were not always careful to explain that NULL was zero.

Of course not, since it's explained in K&R.

>Of course, the shave-a-byte-off-the-source-code weenies would probably
>write
>	if (fd = fopen(...)) {

Weenies like Dennis Ritchie, i suppose?  It's used all through K&R,
what more do you want?

>Somewhere in the distant past, I recommended to the Ansi committee that
>NULL should have been made a reserved word with undefined content.  They
>rejected this request, as they didn't want to add any reserved words to
>the language.

That's not the right reason.

--Joe



More information about the Comp.lang.c mailing list