title: How to avoid problems with size_t and int types in 64bit C++ builds?
body: <p>Today I made a 64bit build of my project for the first time. Basically it compiled, linked and ran ok, except for warnings complaining about incompatibility between the new, 64bit size_t type and the simple int type. This mostly occurs in situations like this in my code:</p>
  
  <pre><code>void func(std::vector&lt;Something&gt; &amp;vec)
  {
      int n = vec.size();
      for (int i=0; i &lt; n; i++)
      {
          ....vec[i]....
      }
  }
  </code></pre>
  
  <p>This is quite easy to fix, and I read an article saying one should rather use size_t or ptrdif_t as loop indices. But what can I do in a situation like this?</p>
  
  <pre><code>void outsideLibraryFunc(int n);
  
  void func(std::vector&lt;Something&gt; &amp;vec)
  {
      int n = vec.size();
      outsideLibraryFunc(n);
  }
  </code></pre>
  
  <p>I can't change the outside library's function declaration, which expects an argument of type int, and I need to pass it the number of the vector elements. What can I do other than disabling the compiler warnings?</p>