Re: dpkg semi-hijack - an announcement (also, triggers)
Pierre Habouzit writes ("Re: dpkg semi-hijack - an announcement (also, triggers)"):
> AHAHAHAHAHA I totally missed that part in the first read. You're
> totally on crack. Under C, NULL is defined as (void *)0
> (and *NOT* (char *)0 that is TOTALLY wrong for obvious reasons), and
> "someone" is not going to #define NULL 0.
ISO/IEC 9899:1999 (E) aka C99:
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.
[*] The macro NULL is defined in <stddef.h> (and other headers) as a
null pointer constant; see 7.17.
The macros are
which expands to an implementation-defined null pointer constant; ...
Note that a `null pointer constant' is only a pointer if it is
converted to a pointer type. Just `0' is an `integer constant
expression with the value 0', and is therefore a `null pointer
constant' which is therefore permitted as a definition for NULL.
So C99 permits an implementation (that is, permits stddef.h) to
#define NULL 0
> If you're so afraid that one of the included headers defines NULL to
> '0', then just assert (__builtin_types_compatible(NULL, void *))
> somewhere and be done with it. But please, (char *)0 is not only wrong,
> it's also tasteless and ugly to the eye.
In what way is (char*)0 wrong in these contexts ?