Undefined behavior of right-shift in C++ Languages

Undefined behavior of right-shift in C++

From cppreference.com:For unsigned a and for signed a with nonnegative values, the value of a >> b is the integer part of a/2b . For negative a, the value of a >> b is implementation-defined (in most implementations, this performs arithmetic right shift, so that the result remains negative).
Read More