What is the default C -std standard version for the current GCC (especially on Ubuntu)?

后端 未结 6 1222
鱼传尺愫
鱼传尺愫 2020-11-27 13:23

When I ask to see the current version of cc I get this.

$ cc --version
cc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, I         


        
6条回答
  •  醉话见心
    2020-11-27 14:22

    useful information from info gcc for gcc6 and https://gcc.gnu.org/onlinedocs/gcc-5.4.0/gcc/Standards.html#Standards for gcc5

    gcc version 6.3.1 - 10.1.0

    2.1 C Language
    ==============
     The default, if no C language dialect options are given, is
    '-std=gnu11'.
    
    2.2 C++ Language
    ================
     The default, if no C++ language dialect options are given, is
    '-std=gnu++14'.
    

    gcc version 5.4.0

    2.1 C Language
    ==============
    The default, if no C language dialect options are given, is -std=gnu11
    
    2.2 C++ Language
    ================
    The default, if no C++ language dialect options are given, is -std=gnu++98
    

    For C, default mode remains std=gnu11, but for C++ it has jumped from std=gnu++98 to std=gnu++14

提交回复
热议问题