How to check if a 64-bit project is being built in Visual Studio using #ifdef


You may easily do it using #define preliminarily defined in the compiler. The following is the code that shows in what mode a project is being built – 32-bit mode or 64-bit mode (AMD64 or Intel 64) or in Itanium mode.

#if defined _M_IX86
      cout << _T(" (x86)");
#elif defined _M_X64
      cout << _T(" (x64)");
#elif defined _M_IA64
    cout << _T(" (Itanium)");
#endif

References



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

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;



Bugs Found

Checked Projects
367
Collected Errors
13 552