Please use NULL instead of 0 whenever you have a pointer!
mark at cbosgd.UUCP
mark at cbosgd.UUCP
Wed Jan 25 04:44:21 AEST 1984
If NULL and 0 are supposed to be the same, please explain what proper
behavior is in the following situation:
execl("/bin/echo", "echo", "hi", "there", 0);
(This is the way it's documented in exec(2) and used everywhere.)
Now, suppose you have a system where ints are 16 bits and char *'s
are 32 bits. (Hmm, sounds like a 68000.) Now, it's clear we have a
series of 32 bit values on the stack, followed by a 16 bit zero, followed
(if you keep looking) by garbage.
The only clean solution I know of (other than using 32 bit ints, which
is inefficient) is to use NULL and have NULL be (void *) 0. This is
obviously pretty painful, given all those programs out there that use
exec.
Considering that it's quite reasonable for either the high 16 bits or
the low 16 bits of a valid 32 bit pointer to be zero, is there some
other reasonable way to handle this?
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list