title: Calculating maximum int value in C program (1 << 31) - 1
body: <p>Compiling this with gcc (4.6.3) yields no warnings and produces -2147483648 as the result.</p>
  
  <pre><code>printf ("%d", (1&lt;&lt;31));
  </code></pre>
  
  <p>Compiling this yields "warning: integer overflow in expression [-Woverflow]" and produces 2147483647 as the result.</p>
  
  <pre><code>printf ("%d". (1&lt;&lt;31)-1);
  </code></pre>
  
  <p>I am confused why the second expression gives the integer overflow warning.</p>