Subject: Re: NULL return value checking
To: NetBSD Kernel Technical Discussion List <tech-kern@netbsd.org>
From: Greywolf <greywolf@starwolf.com>
List: tech-kern
Date: 04/24/2002 09:02:26
On Wed, 24 Apr 2002, Greg A. Woods wrote:

# may also result in any number of other undefined actions too.  Unix
# programmers have come to value the fact that most unix implementations
# will signal SIGSEGV if their programs accidentally dereference NULL.

When all the world was a VAX :), this was not the case -- there was so
much code that was written that assumed that *0 would actually return 0
(which, on the VAX, under UNIX, it did).

# However assuming a null pointer constant is equivalent to zero is now
# absolutely guaranteed (for any compliant compiler :-), and it has
# implicitly been that way since the very dawn of C.

Really.

That's certainly convenient, to say the least.  Wonder what the linker's
doing in there on machines where 

	(void *) 0 != (pointer_width_but_not_pointer) 0

...or does the kernel exec code worry about that?

[pardon the stupid question:  I'm not CCS-adept.]

				--*greywolf;
--
Of course it runs NetBSD.