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: Richard Earnshaw <rearnsha at arm dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: Richard dot Earnshaw at arm dot com, Gabriel Dos Reis <gdr at integrable-solutions dot net>, Paul Koning <pkoning at equallogic dot com>, drow at mvista dot com, fjh at cs dot mu dot OZ dot AU, pinskia at physics dot uc dot edu, aoliva at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Wed, 09 Oct 2002 15:55:01 +0100
- Subject: Re: [c++] warn if NULL is passed through varargs
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> 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.