Re: Peculiar behavior with bit-shifting

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

 



Hi!  Please, do not top-post.

On Sun, Feb 19, 2017 at 04:58:48PM +0100, Niklas Gürtler wrote:
> Your "id" variable is signed, and right-shifting signed integers yields
> implementation-defined behaviour according to the C Standard,

Only right-shifting *negative* numbers is implementation defined.
GCC defines it the obvious way (for two's complement).

But yes, unsigned types would give much less headache here.


Segher



[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