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


> Richard Earnshaw <rearnsha@arm.com> writes:
> 
> |> > Paul Koning <pkoning@equallogic.com> writes:
> |> > 
> |> > [...]
> |> > 
> |> > |  Daniel> - First of all, there's no real way to figure it out.  C++
> |> > |  Daniel> has __null (spelling?), but C just has a NULL somewhere.
> |> > |  Daniel> Defined usually as (void*) 0, at least for GCC.
> |> > | 
> |> > | I had the same reaction.  In C, NULL is just a #define, whose
> |> > | definition varies. 
> |> 
> |> In fact the C standard is quite clear that '(void*) 0' is *NOT* a valid 
> |> definition for NULL.
> 
> ???
> 6.3.2.3[#3] An integer constant expression with the value 0, or such an
> expression cast to type void *, is called a null pointer constant.
> 
> ITYM the C++ standard.

Oops, yes, you're correct.  I knew I'd seen it somewhere.

For the record, that reference is for c99.  For c89 it's 3.2.2.3, but it 
says the same thing.

Sorry for the confusion.

R.


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