[c++] warn if NULL is passed through varargs
Paul Koning
pkoning@equallogic.com
Fri Oct 11 11:17:00 GMT 2002
>>>>> "Fergus" == Fergus Henderson <fjh@cs.mu.oz.au> writes:
Fergus> On 11-Oct-2002, Paul Koning <pkoning@equallogic.com> wrote:
>> >>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:
>>
Richard> On Fri, Oct 11, 2002 at 11:09:20AM -0400, Paul Koning wrote:
>> >> So are you saying that the C standard's statement that 0 is a
>> >> valid way to say "NULL pointer" is wrong, and anyone who relies
>> on >> it is writing broken code?
Fergus> The C standard doesn't say that. The C standard says that 0
Fergus> *if converted to a pointer type* is a null pointer. But
Fergus> passing 0 through varargs does not count as converting it to
Fergus> a pointer type.
Fergus> So yes, anyone who relies on this is writing broken code -
Fergus> albeit broken code that happens to work on most current C
Fergus> implementations.
Ok, I see the point. This all makes sense now.
paul
More information about the Gcc-patches
mailing list