I'm trying to write a simple code (just for learning) to count the number of bit of unsigned int type and I am encountering some problems with Bitwise shift operators.
The behavior is undefined if the right operand is negative, or greater than or equal to the length in bits of the promoted left operand.
So in the second case that is when UI is used the behavior is undefined because it seems that sizeof( int ) on your system is equal to 4 (* 8 bits = 32 )
@vlad from moskow
Thank for your explanation: i didn't know it.
Now I'm studying integer promotion. I think that integer promotion should explain likewise the following example: