-Wconversion and signedness

Alexandre Oliva oliva@dcc.unicamp.br
Wed Jun 23 09:35:00 GMT 1999

On Jun 23, 1999, Alexandre Duret-Lutz <duret_g@epita.fr> wrote:

> Shouldn't egcs complain with -Wconversion on the following snippet :

>   unsigned  i = 2;
>   unsigned  j = -i;

Nope.  Unary minus, when applied to an unsigned integral value i,
means unsigned `2^n - i', where `n' is the number of bits in the
unsigned type.

Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
*** E-mail about software projects will be forwarded to mailing lists

More information about the Gcc mailing list