chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Request for comments on the SQLite3 egg API


From: Peter Keller
Subject: Re: [Chicken-users] Request for comments on the SQLite3 egg API
Date: Tue, 3 Jul 2007 16:52:28 -0500
User-agent: Mutt/1.4.2.1i

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]