This is the mail archive of the
mailing list for the GCC project.
Re: -Wconversion versus libstdc++
> | Careful. As you suggest, let's restrict ourselves to two's complement
> | platforms. I would want the compiler to warn if the identity holds for an
> | ILP32 machine but not an LP64 machine, even if I'm running on an ILP32.
> | But if the two types are going to be the same size everywhere (because one
> | is the unsigned modifier of the other) then GCC should not complain.
On Wed, Jan 17, 2007 at 04:59:02PM -0600, Gabriel Dos Reis wrote:
> The specific cases I'm concerned about here (and if you have a chance
> to build firefox for example, you'll see) is when T and U differ only
> in signedness, that is
> T = int, U = unsigned
> T = long, U = unsigned long
> T = long long, U = unsigned long long
> those have the same value representation bits and there is no way, GCC
> can mess up -- except bugs in the compiler itself.
> Furthermore, elsewhere (in the overflow thread) it has been suggested
> that people should convert to the unsigned variants, do computations there,
> and convert back to the signed variants. We have just promised an
> invariant that we will hold.