开发者

capture C++0x flag inside the program [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

GNU C++ how to check when -std=c++0x is in effect?

What I want to do is:

 #if defined(CPLUSPLUS_OXF开发者_JAVA百科LAG)
  //do something
 #else
  //do something else
 #endif

Now how can I capture -std=c++0x argument passed to the compiler(g++) to define my CPLUSPLUS_OXFLAG flag?


The GCC documentation states that the preprocessor symbol __GXX_EXPERIMENTAL_CXX0X__ is defined when compiling with -std=c++0x.


For GCC have a look at this:

__GXX_EXPERIMENTAL_CXX0X__

This macro is defined when compiling a C++ source file with the option -std=c++0x or -std=gnu++0x. It indicates that some features likely to be included in C++0x are available. Note that these features are experimental, and may change or be removed in future versions of GCC.

Find the reference here.


GCC defines __GXX_EXPERIMENTAL_CXX0X__ when std=c++0x is enabled.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜