C ++ 11预定义宏 [英] C++11 predefined macro
问题描述
C ++有没有任何预定义的宏,以便代码可以识别标准?
Are there any predefined macros for C++ in order the code could identify the standard?
例如。目前大多数编译器将array放入tr1文件夹,但对于C ++ 11,它将是STL的一部分。所以目前
e.g. Currently most compilers puts "array" into "tr1" folder but for C++11 it would be part of STL. So currently
#include <tr1/array>
但是c ++ 11
#include <array>
03标准和11标准的预定义宏是什么,为了我可以使用 #ifdef
以识别?
What is the predefined macros for 03 standard and 11 standard in order I can use #ifdef
to identify?
此外,我想有C90和C99的宏吗?
Also, I suppose there are macros for C90 and C99?
谢谢
推荐答案
从此处
在C ++ 0x中,宏__cplusplus将被设置
In C++0x the macro __cplusplus will be set to a value that differs from (is greater than) the current 199711L.
您可以测试它的值来确定如果是c ++ 0x或不是,则
You can likely test it's value to determine if it's c++0x or not then
这篇关于C ++ 11预定义宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!