C/C++ Learning

您正在查看: 标签 macro 下的文章

如何通过宏来判断处理器类型(How to detect the processor type using compiler predefined macros)

1、ItaniumA.K.A.: IA64 Developer: Intel Processors: Itanium, Itanium 2, Itanium 2 9000/9100/9300, etc. 代码: #if defined(__ia64) || defined(__itanium__) || defined(_M_IA64) /* Itanium ----...阅读全文

如何通过宏来判断操作系统的类型(How to detect the operating system type using compiler predefined macros)

1、AIXDeveloper: IBM Distributions: AIX Processors: POWER代码: #if defined(_AIX) /* IBM AIX. ------------------------------------------------- */ #endif2、BSDDeveloper: Open source Dist...阅读全文

如何通过宏来检查编译器名称和版本信息(How to detect the compiler name and version using compiler predefined macros)

1、如何检查编译器名称 代码: #if defined(__clang__) /* Clang/LLVM. ---------------------------------------------- */ #elif defined(__ICC) || defined(__INTEL_COMPILER) /* Intel ICC/ICPC. ------------------------...阅读全文

如何查看编译器的宏(How to list compiler predefined macros)

大多数编译器都有命令行选项来列出所支持的宏注:在某些开源的编译器源码中也可以找到支持的宏如:Clang 、LLVM中宏主要定义文件为llvm/tools/clang/lib/Basic/Targets.cpp GCC 、 G++中宏主要定义文件为gcc/config/* 题外小知识:linux中有一个strings命令可以以二进制形式查看文本或者程序中的可打印字符串,对与编译器而言,这些串包...阅读全文