This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: pointer <-> integer conversion warnings (bogus -Wall warnings)
From: Richard Henderson <rth@redhat.com>
No, that's what C99's intptr_t is for. But as it happens, I've
never seen a system for which size_t was not the correct size
[for integer -> pointer conversion]
and
x = (int)(size_t) p;
That double cast is not safe.
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.
-t