Right shift of a negative integer

suggest change

Right-shifting a negative signed value is implementation-defined. The shift count must be non-negative and strictly less than the width of the promoted left operand; any other count is undefined behavior.

int signed_integer = -1;
int result = signed_integer >> 1; /* implementation-defined */

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents