Re: Strange enum type conversion

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

 



John (Eljay) Love-Jensen wrote:

> Also be aware that if your "1 << 31" goal is to set the high bit, then your
> code is not portable.  If the platform has 64-bit int, you will instead be
> setting a middle bit.  If the platform has 16-bit int, such a shift is
> undefined behavior.

Isn't it UB on a 32-bit machine as well?  Looks like integer overflow to me.

Andrew.

[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