"Dimitrie O. Paun" <[EMAIL PROTECTED]> writes:

> On November 27, 2003 01:38 am, Shachar Shemesh wrote:
>
>> While I will be happy to hear Dimi's rational for his, I
>> don't think there is much room for an actual "discussion",
>> as these things tend to turn into religious flame wars.
>
> There are some things that are _absolutely_ fundamental to
> the language, and one of them is that NULL is 0. The
> 'NULL' abstraction is paper thin, and it simply doesn't
> give you anything.  Can you change the definition of NULL
> to, say, 1 on some architecture without breaking stuff
> left right and center? No.

Let me get into this (while waiting for my previous posts to
arrive to the list).  I'd rather say that 0 is NULL.  Of
course, NULL exists only in our minds, it's a #define, but

      According to the language definition, a constant 0 in
      a pointer context is converted into a null pointer at
      compile time. <http://www.eskimo.com/~scs/C-faq/q5.2.html>

Also, we have to take care:

      To generate a null pointer in a function call context,
      an explicit cast may be required, to force the 0 to be
      recognized as a pointer. For example, the Unix system
      call execl takes a variable-length, null-pointer-
      terminated list of character pointer arguments, and is
      correctly called like this:

      execl("/bin/sh", "sh", "-c", "date", (char *)0);

> So then what is its purpose, other than some sort of warm
> and fuzzy feeling of doing the 'right' thing? It just
> shows that we don't understand that in C values are either
> zero or non-zero, and that is the first stone at the
> foundation of the language, and you simply can not change
> that.

I can't agree with the above, see the surrsoundings of the
cited page.  To cite more:

Summary:

Unadorned 0 okay:    |    Explicit cast required:
---------------------+----------------------------
initialization       |    function call,
                     |    no prototype in scope
assignment           |
                     |    variable argument in
comparison           |    varargs function call
                     |
function call,       |
prototype in scope,  |
fixed argument       |

Hmm, those winetests code samples seem to be missing in
action.  I give them some more time, then repost them.

Feri.

Reply via email to