[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: casting NULL within a varargs list

From: John Darrington
Subject: Re: casting NULL within a varargs list
Date: Thu, 23 Sep 2010 13:03:30 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

Ok.  Thanks for pointing that out.


On Tue, Sep 21, 2010 at 10:11:04PM -0700, Ben Pfaff wrote:
     The recent commit c75794cff "Const casts" removes some casts of
     NULL to a pointer type within varargs parameter lists.  This will
     cause problems on 64-bit systems that #define NULL to 0 (without
     any cast to pointer type).  This is a special case where the cast
     cannot be removed.  (If you want to introduce a macro for this
     case, to make it obvious what's going on, that's fine with me.)
     The GNU coding standards even has a specific exception for this:
         Zero without a cast is perfectly fine as a null
         pointer constant, except when calling a varargs function.
     (For what it's worth, I prefer NULL over 0 as a null pointer
     constant.  It makes it obvious that it's a pointer instead of an
     Ben Pfaff

PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]