Newsgroups: comp.os.minix
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: NULL macro
Message-ID: <1989Nov15.220450.8289@utzoo.uucp>
Organization: U of Toronto Zoology
References: <710@crash.cts.com>
Date: Wed, 15 Nov 89 22:04:50 GMT

In article <710@crash.cts.com> cwr@pnet01.cts.com (Will Rose) writes:
>     #define NULL 0
>     #define NULL 0L
>     #define NULL (void *)0
>
>Most MSDOS C compilers (he goes on to say) conditionally compile NULL into one
>of the first two definitions; the third case should work in all
>ANSI-conforming programs, but there are plenty of cases where it won't work in
>non-ANSI code.

Actually, all three definitions *will* work in all ANSI-conforming programs
compiled on ANSI-conforming implementations.  The choice between them is
based solely on the desire to break as few non-conforming programs as
possible, by making NULL be a zero of the "right size" (the "void *" choice
is there because some machines have pointers longer than "long").  Of course,
on some machines there *is* no single "right size", or a zero is not the
right bit pattern, in which case non-conforming programs are up the creek.
