title: C++ while loop optimization not working properly
body: <p>I have this code segment:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(int argc, const char** argv)
  {
      int a = argv[0][0];
      int b = argv[0][1];
  
      while ((a &gt;= 0) &amp;&amp;
             (a &lt; b))
      {
          printf("a = %d\n", a);
          a++;
      }
  
      return 0;
  }
  </code></pre>
  
  <p>and I'm compiling it with <code>gcc-4.5 -02 -Wstrict-overflow=5</code>.</p>
  
  <p>The compiler yells at me
  <code>warning: assuming signed overflow does not occur when changing X +- C1 cmp C2 to X cmp C1 +- C2</code></p>
  
  <p>What does this mean exactly?</p>
  
  <p>If i am correct, this loop will never cause an overflow, because for a to be incremented, it must be smaller than another integer. If it is bigger, the loop is terminated.</p>
  
  <p>Can anyone explain this behavior to me?</p>