On 10/13/14 13:02, Óscar Fuentes wrote:
> Some developers have been trapped by assuming that _W64 indicates a
> Windows 64 bits target. But it is defined for 32 bits too:
>
> #include <math.h>
> #ifdef _W64
> int w64 = 0;
> #endif
> #ifdef _WIN64
> int win64 = 0;
> #endif
>
>
> The prepocessed output ends with
>
> int w64 = 0;
>
>
> This is with
>
> $ gcc -v
> Using built-in specs.
> COLLECT_GCC=C:\apps\msys64\mingw32\bin\gcc.exe
> COLLECT_LTO_WRAPPER=C:/apps/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/lto-wrapper.exe
> Target: i686-w64-mingw32
> Configured with: ../gcc-4.9.1/configure --prefix=/mingw32 
> --with-local-prefix=/mingw32/local --build=i686-w64-mingw32 
> --host=i686-w64-mingw32 --target=i686-w64-mingw32 
> --with-native-system-header-dir=/mingw32/i686-w64-mingw32/include 
> --libexecdir=/mingw32/lib --with-gxx-include-dir=/mingw32/include/c++/4.9.1 
> --enable-bootstrap --with-arch=i686 --with-tune=generic 
> --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared 
> --enable-static --enable-libatomic --enable-threads=posix --enable-graphite 
> --enable-fully-dynamic-string --enable-libstdcxx-time=yes 
> --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-cloog-backend=isl 
> --enable-version-specific-runtime-libs --disable-cloog-version-check 
> --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib 
> --enable-checking=release --disable-rpath --disable-win32-registry 
> --disable-nls --disable-werror --disable-symvers --with-libiconv 
> --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mingw32 
> --with-mpc=/mingw32 --with-isl=/mingw32 --with-cloog=/mingw32 
> --with-pkgversion='Rev6, Built by MSYS2 project' 
> --with-bugurl=http://sourceforge.net/projects/msys2 --with-gnu-as 
> --with-gnu-ld --disable-sjlj-exceptions --with-dwarf2
> Thread model: posix
> gcc version 4.9.1 (Rev6, Built by MSYS2 project)
>
>
> The same experiment but with the 64 bits compiler shows that both _W64
> and _WIN64 are defined.
>
> What's the rationale of this?
>
> Can we assume that _WIN64 is the correct way of detecting that the
> MinGW-w64 compiler targets Windows 64?

Yes, that's the right way.

> Is the _W64 thing a bug on MinGW-w64?

No, see:
http://stackoverflow.com/questions/1686332/how-do-i-use-w64-and-w64-in-vc
We need this define so that a code written for MSVC will work.

Jacek


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to