Which C++ standard is the default when compiling with g++?

后端 未结 9 574
故里飘歌
故里飘歌 2020-11-29 23:59

I have a piece of code that looks like the following. Let\'s say it\'s in a file named example.cpp

#include 
#include 

        
9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 00:18

    I believe that it is possible to tell by looking at the man page (at least for g++):

    Under the description of -std, the man page lists all C++ standards, including the GNU dialects. Under one specific standard, it is rather inconspicuously stated, This is the default for C++ code. (there is an analogous statement for C standards: This is the default for C code.).

    For instance, for g++/gcc version 5.4.0, this is listed under gnu++98/gnu++03, whereas for g++/gcc version 6.4.0, this is listed under gnu++14.

提交回复
热议问题