[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#217360: gcc-3.2: meaningless warning for %p in format strings



Jason Kraftcheck <kraftche@cae.wisc.edu> writes:

> If the following is compiled with the options -Wall -pedantic-errors :
>   #include <stdio.h>
>   int main( )
>   {
>     int i;
>     printf("%p\n", &i );
>     return 0;
>   }
> 
> gcc emits the following:
>   voidptr.c: In function `main':
>   voidptr.c:5: warning: void format, different type arg (arg 2)
> 
> This warning is meaningless.  The type of the pointer doesn't matter
> for printf to write out the address.

According to the C standard, it does. And you specifically asked for
gcc to be pedantic.

> The warning message is wrong.  Should be 'pointer format' or maybe 
> 'void* format', not 'void format'.  

That is a valid complaint.

-- 
	Falk



Reply to: