title: What does the C standard say about bitshifting more bits than the width of type?
body: <p>Consider the following code:</p>
  
  <pre><code>int i = 3 &lt;&lt; 65;
  </code></pre>
  
  <p>I would expect that the result is <code>i==0</code>, however the actual result is <code>i==6</code>. With some testing I found that with the following code:</p>
  
  <pre><code>int i, s;
  int a = i &lt;&lt; s;
  int b = i &lt;&lt; (s &amp; 31);
  </code></pre>
  
  <p>the values of <code>a</code> and <code>b</code> are always the same. </p>
  
  <p>Does the C standard say anything about shifting more than 32 bits (the width of type <code>int</code>) or is this unspecified behavior?</p>