C99 not default C- version for GCC?

后端 未结 4 1834
别那么骄傲
别那么骄傲 2020-12-06 17:28

Why does not GCC compile the C99 by default? I mean why is it necessary to add --std=c99 flag everytime a code in C99 is written?

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 18:07

    The reason is that default configurations of gcc take a really long time to be changed, since every time a default configuration is changed, it can potentially break the compilation of valid programs (in this case valid c89 programs which are invalid in c99). Starting with gcc 5.0, the default C standard used by gcc will be gnu11, which is c11 with gnu extensions (see here):

    The default mode for C is now -std=gnu11 instead of -std=gnu89.

提交回复
热议问题