Warning for different pointer signedness
Andrew Pinski
pinskia@physics.uc.edu
Mon Dec 20 20:55:00 GMT 2004
On Dec 20, 2004, at 3:47 PM, Paul Schlie wrote:
>> From: Andrew Pinski <pinskia@physics.uc.edu>
>> Wrong, wrong, wrong, the change only moved a warning from -pedantic
>> to always on, in fact some compilers reject the code as it is invalid
>> c.
>>
>> -- Pinski
>
> Which seems odd given (signed xxx *) and (unsigned xxx *) will always
> be
> guaranteed to be pointers to the exact same size and aligned storage
> units;
> (therefore at best, seems like a mistake to consider them incompatible
> objects for the purpose of comparison, as no possible ambiguity
> exists).
The warning is only there for an implicit conversions nothing else, if
you
add a cast it will not warn. Well this is what the C standard say so
you are wrong again.
6.3.2.3 describes the conversions. Again this is invalid C (and C++ in
fact) so a warning is correct.
The only implicit conversion for pointers in C is to and from void*.
-- Pinski
More information about the Gcc
mailing list