On Wed, Jul 04, 2007 at 12:42:18AM +0700, Ivan Shmakov wrote:
> Well, I program C since 1995 or so (started to study x86
> assembler about the same time.) In my programs, I tend to
> distinguish NULL (or 0) from false. E. g., I'd write:
ASIDE:
As a small note. 0 is not entirely equivalent to NULL in one technical case.
You may not pass 0 through a ... and then check it for NULL in the callee. Case
in point execve("something", "something", "args", 0).
This is because the C spec says that ... types are promoted to an int,
which on 64 bit architectures, doesn't have to be the same size as a
pointer, which NULL often is. In this case, ripping off 64 bits from
the stack will rip off 32 bits too many since the bare 0 is be nature
an int sized quantity.
While NULL is often (void*)0 or (char*)0, I've seen esoteric platforms in which
it is just plainly 0.
So, really, you should check pointers against NULL, especially if they
were gotten through a ... .
-pete
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users