Subject: Re: NULL return value checking
To: None <firstname.lastname@example.org>
From: Gary Thorpe <email@example.com>
Date: 04/23/2002 18:44:20
As far as I know, using NULL explicitly makes programs more portable (a low
priority for code specific to any OS kernel obviously).
I have always seen NULL defined as 0. However, NULL simply represents an
invalid value for a pointer, and its actually value is PLATFORM SPECIFIC as
far as ANSI compliant code goes. That is, a platform can define NULL to be
any value which the platform would interprit to be an invalid pointer. NULL
is usually zero because the first address in memory is usually never
referenced or reserved.
Assuming it is zero is technically incorrect. It *could* be non-zero, in
which case the resulting branch of the if() block would be different. Since
this is code which I assume is for the NetBSD kernel, then it only depends
on how NetBSD defines NULL.
Chat with friends online, try MSN Messenger: http://messenger.msn.com