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
NULL
which expands to an implementation-defined null pointer constant; and
0 is not a pointer, hence disqualifies.
Cheers,
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
Attachment:
pgpyGCwcfGea5.pgp
Description: PGP signature