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:
cout << sizeof(long) << " " << sizeof(void*) << endl ;
prints 4 8
, not 8 8
. The documentation for g++ 4.6.0 says:
The 64-bit environment sets int to 32 bits and long and pointer to 64 bits
Does anybody know why sizeof(long)
is not 8?
Edited to add: 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 long
, so the documentation simply doesn't apply to it. Indeed, if you go to the relevant web page, the full entry for IA-32/x86-64 consists of this:
...
long long
in g++. – Mathematics