我想在 Visual C 中定义 32(32 位编译)和 64(64 位编译)。是否有任何预定义的宏?我徒劳地搜索了 MSDN。
您认为 32 和 64 的这种定义可行吗?
#define _32_ if !(defined __LP64__ || defined __LLP64__) || defined _WIN32 && !defined _WIN64
// we are compiling for a 32-bit system
the else statement will be _64_ definition
// we are compiling for a 64-bit system
谢谢!
最佳答案
来自 the docs :
_M_IX86: Defined for x86 processors. ... This is not defined for x64 processors.
_M_X64: Defined for x64 processors.
_M_IA64: Defined for Itanium Processor Family 64-bit processors.
_WIN32: Defined for applications for Win32 and Win64. Always defined.
_WIN64: Defined for applications for Win64.
任你选。
关于c++ - Visual C++ 中的 _32_ 和 _64_ 等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11752111/