title: Is this loop implicitly casting an int to size_t?
body: <p>I ran into a bug in my program:</p>
  
  <pre><code>for (int i = 0; i &lt; objArray.size() - 1; ++i)
  </code></pre>
  
  <p>In my case objArray.size() is an unsigned long long and an empty vector minus 1 equals about 18 quintillion. I was wondering, does the loop on every iteration have to cast an int to an unsigned long long? I checked the assembly and while using an int creates different code than size_t without optimisations, with -O2 specified it generates exactly the same assembly. Does this mean it's not implicitly casting?</p>
  
  <p>I don't understand assembly, but the code it generated was:</p>
  
  <pre><code>test rcx, rcx
  je .L32
  add rdx, rax
  </code></pre>
  
  <p>and then :</p>
  
  <pre><code>cmp rdx, rax
  jne .L28
  </code></pre>