This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pointer <-> integer conversion warnings (bogus -Wall warnings)


On Wed, Mar 13, 2002 at 04:25:51PM -0800, Tom Lord wrote:
> 	x = (int)(size_t) p;
> 
> That double cast is not safe.

Care to explain your reasoning?  Care to point to a system for
which it fails?

> The simple rule that explicit casts to appropriate types don't
> generate warnings in the absense of extraordinary options gives this
> class of warnings a clear and useful relation to the various
> standards.  I don't understand why that rule is at all controversial.

Because virtually all code that pointer to integer casts with "int" 
breaks on 64-bit targets.  This is not speculation; this is hard
experience bringing alpha-linux up from the first shell prompt.

The warning isn't going to change.  It is going to remain enabled
with no -W flags whatsoever.  Live with it.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]