c++ - Visual C++ 中的 _32_ 和 _64_ 等价物

标签 c++ c visual-c++

我想在 Visual C 中定义 32(32 位编译)和 64(64 位编译)。是否有任何预定义的宏?我徒劳地搜索了 MSDN。

您认为 3264 的这种定义可行吗?

#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/

相关文章:

c++ - 为什么文字的基数会影响它的类型?

c++ - O(log N) 查找和更新的数据结构,考虑到小型 L1 缓存

c - 如何使用 wchar_t 连接整数

c++ - 在 Visual C++ 中使用的简单的面向对象的 2D 图形框架?

c++ - std::async 究竟是如何执行的?

无法分配请求的地址 - 可能的原因?

c - 我应该在 Mac OS X 上使用哪个 libc strcpy/strlcpy/strncpy?

C程序错误: expected expression before int

visual-studio-2010 - 在 MVC++ 2010 上的 Win32 应用程序中输出到控制台/调试窗口

C++ 文件访问/输入和输出