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]

Re: -Wconversion and signedness


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}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists


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