>
>
Using _WIN64/WIN64 macros

Andrey Karpov
Articles: 673

Using _WIN64/WIN64 macros

The _WIN64 macro will be always predefined by the compiler itself while building for any 64-bit Windows family OS, so this macro should not ever be defined manually. It's worth noting that _WIN64 is defined by the compiler regardless of the 64-bit architecture being used (as for the x64 or IA64), so in case it is necessary to write a platform-specific code, the M_IA64 or _M_AMD64 macros should be used instead. _WIN64 also could be defined together with _WIN32 if there is a need to use Win32 API inside the 64-bit build.

The WIN64 macro is not a part of Visual C++ standard predefined macros and it is not utilized anywhere inside of VC++ system include files, as such it can be manually defined anywhere in the code. Quite often this macro is utilized by third-party developers to distinguish the versions of their own APIs.

References