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

前端 未结 3 1045
梦毁少年i
梦毁少年i 2020-11-29 18:38

My system compiler (gcc42) works fine with the TR1 features that I want, but trying to support newer compiler versions other than the systems, trying to accessing TR1 header

3条回答
  •  温柔的废话
    2020-11-29 19:03

    Well, from gcc-4.7 onwards you'll be able to check __cplusplus:

    "G++ now sets the predefined macro __cplusplus to the correct value, 199711L for C++98/03, and 201103L for C++11"

    This should be the correct, standard-compliant way to do it. Unfortunately, it doesn't work for most gcc installed in the wild.

提交回复
热议问题