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



Use PVS-Studio to search for bugs in C, C++ and C# code

We offer you to check your project code with PVS-Studio. Just one bug found in the project will show you the benefits of the static code analysis methodology better than a dozen of the articles.

goto PVS-Studio;



Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;