[Top][All Lists]

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

casting NULL within a varargs list

From: Ben Pfaff
Subject: casting NULL within a varargs list
Date: Tue, 21 Sep 2010 22:11:04 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

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

reply via email to

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