Java throws exceptions on overflow (and underflow), which presumably interferes with that, e.g.:<p><pre><code>  int A = 3000000000;
  int B = 3000000000;
  int C = -3000000000;
  int D;
  D = A + B + C;
</code></pre>
Depending on order of evaluation, this either throws an overflow exception or assigns the number 3 billion to D. There is a hard rule in the spec that defines what must happen here. In C or C++ there are no such exceptions, so the compiler can (and does) transform arithmetic expressions where it's advantageous. (this is obviously a trivial example which will compile down to a constant anyway)