This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [c++] warn if NULL is passed through varargs
- From: Paul Koning <pkoning at equallogic dot com>
- To: aoliva at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 9 Oct 2002 09:44:31 -0400
- Subject: Re: [c++] warn if NULL is passed through varargs
- References: <ork7ks9uls.fsf@free.redhat.lsd.ic.unicamp.br>
>>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes:
Alexandre> Since C++ requires NULL to not be a pointer type, when you
Alexandre> pass NULL through an ellipsis, you probably end up with a
Alexandre> type different than what you expected. You pretty much
Alexandre> have to cast NULL to the right pointer type in order to
Alexandre> guarantee you get the right thing on the other end.
Alexandre> Arranging for NULL to be an integer constant that
Alexandre> evaluates to zero with an integer type as wide as a
Alexandre> pointer would be ideal, but since there's no guarantee
Alexandre> imposed by the C++ Standard that such an integer type
Alexandre> exists,...
Nor is there a requirement that the representation of a null pointer
is the same as the representation of integer zero, even if it has the
same number of bits -- right?
paul