K
Keith Thompson
[...]Daniel Kraft said:I did encounter a strange problem in my C program, and traced it down;
it looks like I get different results for bit left shifts when the bit
count is a constant or a funtion-return value.
When doing (1 << 32) for a 32-bit-unsigned I expect to get 0; can I
assume this, or is this something I should never do?
It's something you should never do. Quoting the standard,
If the value of the right operand is negative or is greater than
or equal to the width of the promoted left operand, the behavior
is undefined.