Undefined behavior of right-shift in C++ : <p>From cppreference.com:</p>

<blockquote>
  <p>For unsigned a and for signed a with nonnegative values, the value of
  a >> b is the integer part of a/2<sup>b</sup> . 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).</p>
  
  <p>In any case, if the value of the right operand is negative or is
  greater or equal to the number of bits in the promoted left operand,
  the behavior is undefined.</p>
</blockquote>

<p>Why do we have an undefined behavior in case the right operand is greater or equal to the number of bits in the promoted left operand?<br/>
It seems to me that the result should be 0 (at least for unsigned/positive integers)...</p>

<p>In particular, with g++ (version 4.8.4, Ubuntu):</p>

<pre><code>unsigned int x = 1;
cout &lt;&lt; (x &gt;&gt; 16 &gt;&gt; 16) &lt;&lt; " " &lt;&lt; (x &gt;&gt; 32) &lt;&lt; endl;
</code></pre>

<p>gives: <code>0 1</code></p>
