This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [c++] warn if NULL is passed through varargs


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]