Re: dpkg semi-hijack - an announcement (also, triggers)
On Sun, Mar 09, 2008 at 06:34:48PM +0100, Pierre Habouzit wrote:
> On Sun, Mar 09, 2008 at 05:21:47PM +0000, Kurt Roeckx wrote:
> > On Sun, Mar 09, 2008 at 05:50:16PM +0100, Pierre Habouzit wrote:
> > >
> > > 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.
> > It is defined like that on some OSs.
> Not in Debian, and dpkg is mostly a Debian tool, working on the glibc,
> that defines NULL the proper way.
> > It's perfectly valid to do that.
> No it's not, and OSes that do, are not C99 compliant (and not even C89 IIRC,
> but I've no C89 spec at hand to check).
> > In case of stdarg you need to cast NULL to a pointer.
> That's the very reason why NULL shall be a pointer.
> Here is the relevant C99 quote:
> § 7.17 Common definitions <stddef.h>
> 3 The macros are
> which expands to an implementation-defined null pointer constant; and
3 An integer constant expression with the value 0, or
such an expression cast to type void *, is called a null
pointer constant.55) If a null pointer constant is assigned
to or compared for equality to a pointer, the constant is
converted to a pointer of that type. Such a pointer, called
a null pointer, is guaranteed to compare unequal to a
pointer to any object or function.
55) The macro NULL is defined in <stddef.h> as a null pointer
constant; see 7.17.