Re: gcc-4.2 -pedantic is too pedantic
Re: gcc-4.2 -pedantic is too pedantic
- Subject: Re: gcc-4.2 -pedantic is too pedantic
- From: Clark Cox <email@hidden>
- Date: Thu, 17 Sep 2009 23:03:04 +0200
On Wed, Sep 16, 2009 at 4:41 PM, John Reppy <email@hidden> wrote:
> When compiling some existing code on Snow Leopard, I'm getting warnings
> about the use the use of the "%p" format specifier that seem excessive.
> For example
>
> <jhr@woton> cat p.c
> #include <stdio.h>
> void foo (int *x) { printf("%p\n", x); }
> <jhr@woton> gcc -c -pedantic -m64 p.c
> p.c: In function ‘foo’:
> p.c:2: warning: format ‘%p’ expects type ‘void *’, but argument 2 has
> type ‘int *’
>
> Since pointer types silently convert to void * in other cases, this warning
> seems wrong to me.
They do not automatically convert when passed to functions such as
printf, and the C standard allows different pointer types to have
different representations. GCC is technically correct in offering this
warning (you *did* ask it to be pedantic :) )
--
Clark S. Cox III
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden