This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: NULL used in arithmetic
- From: Ian Lance Taylor <iant at google dot com>
- To: morrell at alumni dot ucsd dot edu
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 01 Jul 2009 12:52:09 -0700
- Subject: Re: NULL used in arithmetic
- References: <421805.38171.qm@web112608.mail.gq1.yahoo.com>
Michael Morrell <morrell@alumni.ucsd.edu> writes:
> The following code compiles without warning using g++ version 4.2.1, but I
> get a warning "NULL used in arithmetic" with version 4.3.3. Is the code
> wrong or is the compiler wrong?
>
> ================================
> #include <stddef.h>
>
> class FooClass
> {
> };
>
> typedef void (FooClass::*foo_type)(void);
>
> int foo(foo_type x)
> {
> return x != NULL;
> }
> ================================
I believe the compiler is wrong.
However, I can't recreate the problem using gcc 4.3.2, nor with
mainline. I'm not sure why you are seeing that.
Ian