On Sun, May 04, 2014 at 11:30:40PM +0200, Alexander Hall wrote:
> NULL theoretically could be != 0

Umm... short of something like:
    #undef NULL
    #define NULL "I'm silly and want to break everything"
or something, I don't see when that'd be the case.

According to ISO/IEC 9899:1999 TC3 (n1256) and the freely available
draft of ISO/IEC 9899:201x (n1570), section 6.3.2.3, paragraph 3: [1]

    An integer constant expression with the value 0, or such an
    expression cast to type void *, is called a null pointer constant.
    If a null pointer constant is converted to a pointer type, the
    resulting pointer, called a null pointer, is guaranteed to compare
    unequal to a pointer to any object or function.

So while it might not be cast to a pointer, it's still zero.

And for what it's worth, POSIX does define it to be (void *)0 [2]

    The <stddef.h> header shall define the following macros:

    NULL
        Null pointer constant.  The macro shall expand to an integer
        constant expression with the value 0 cast to type void *.

[1] http://www.iso-9899.info/n1256.html#6.3.2.3p3
[2] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html

Did I miss something again?

Reply via email to