title: Type of integer literals not int by default?
body: <p>I just answered <a href="https://stackoverflow.com/q/8108171/743214">this question</a>, which asked why iterating until 10 billion in a for loop takes so much longer (the OP actually aborted it after 10 mins) than iterating until 1 billion:</p>
  
  <pre><code>for (i = 0; i &lt; 10000000000; i++)
  </code></pre>
  
  <p>Now my and many others' obvious answer was that it was due to the iteration variable being 32-bit (which never reaches 10 billion) and the loop getting an infinite loop.</p>
  
  <p>But though I realized this problem, I still wonder what was really going on inside the compiler?</p>
  
  <p>Since the literal was not appended with an <code>L</code>, it should IMHO be of type <code>int</code>, too, and therefore 32-bit. So due to overflow it should be a normal <code>int</code> inside the range to be reachable. To actually recognize that it cannot be reached from <code>int</code>, the compiler needs to know that it is 10 billion and therefore see it as a more-than-32-bit constant.</p>
  
  <p>Does such a literal get promoted to a fitting (or at least implementation-defined) range (at least 64-bit, in this case) automatically, even if not appended an <code>L</code> and is this standard behaviour? Or is something different going on behind the scenes, like UB due to overflow (is integer overflow actually UB)? Some quotes from the Standard may be nice, if any.</p>
  
  <p>Although the original question was C, I also appreciate C++ answers, if any different.</p>