Re: Strange enum type conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2009-12-03 at 04:22 -0800, John (Eljay) Love-Jensen wrote:
> Hi Hajo,
> 
> Normal promotion rules apply.
> 
> You have both:
> 1 << 31 (which is a signed int)
Correct (on a machine with 32 bit int)

> 0xFFFFFFFF (which is an unsigned int)

wrong.  That's an int with a bit pattern that's all 1's.  On a two's
complement machine with 32-bit ints that's equivalent to -1.

If you want an unsigned value you need 0xFFFFFFFFU

R.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux