3 ms·
> Why does the following code return 0 and not -1? This questions appears twice in the article. Note that shifting a 32-bit integer (no matter the sign) by 32
by alco 13y ago
> Why does the following code return 0 and not -1?
This questions appears twice in the article.
Note that shifting a 32-bit integer (no matter the sign) by 32 is undefined behavior (§6.5.7, 3). I'm using Clang, and its `int` has 32 bits even on a 64-bit system.
C is deceptively simple.