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(
MinGW is designed to build Windows applications, and the Microsoft platform ABI specifies that int and long have the same size of 32 bits. If MinGW defined long differently from MSVC, most existing Windows apps that use long would break when compiled using MinGW.
Having said that, Cygwin x86_64 does follow the LP64 convention on Windows, just like on Linux (source).
So you can use that to build a Windows app where the size of long is 8 bytes :)
Test case:
#include
#include
int CALLBACK WinMain(HINSTANCE a, HINSTANCE b, LPSTR c, int d)
{
char buf[100];
snprintf(buf, sizeof(buf),
"sizeof(int)=%d, sizeof(long)=%d, sizeof(long long)=%d\n",
sizeof(int), sizeof(long), sizeof(long long));
MessageBox(NULL, buf, "Cygwin Test", MB_OK);
return 0;
}
Compile with: C:\cygwin64\bin\gcc.exe -mwindows -m64 cygwin-test.c -o cygwin-test
Output: