title: sizeof(long) in 64-bit C++
body: <p>I have downloaded MinGW-64, so I can now compile 64-bit programs for Windows 7, using g++ 4.7.0 (experimental). But the following line:</p>
  
  <pre><code>cout &lt;&lt; sizeof(long) &lt;&lt; " " &lt;&lt; sizeof(void*) &lt;&lt; endl ;
  </code></pre>
  
  <p>prints <code>4 8</code>, not <code>8 8</code>. The documentation for g++ 4.6.0 says:</p>
  
  <blockquote>
    <p>The 64-bit environment sets int to 32 bits and long and pointer to 64 bits</p>
  </blockquote>
  
  <p>Does anybody know why <code>sizeof(long)</code> is not 8?</p>
  
  <p><strong>Edited to add:</strong> The source of my confusion was that g++ 4.7.0 for 64-bit Windows is not (yet) an official part of the GNU Compiler Collection. And it's the first 64-bit version with a 32-bit <code>long</code>, so the documentation simply doesn't apply to it. Indeed, if you go to the <a href="http://gcc.gnu.org/gcc-4.7/changes.html" rel="noreferrer">relevant web page</a>, the full entry for <strong>IA-32/x86-64</strong> consists of this:</p>
  
  <blockquote>
    <p>...</p>
  </blockquote>