开发者

C99 not default C- version for GCC?

Why does not GCC compile the C99 by default? I mean why is it necessary to add --std=c99 flag everytime a c开发者_如何学编程ode in C99 is written?


Edit: As of GCC 5, -std=gnu11 is the default. See Porting to GCC 5.


See C Dialect Options, gnu89 is the default.

`gnu89'

GNU dialect of ISO C90 (including some C99 features). This is the default for C code.

As @tsv mentioned, ISO C99 is not fully supported yet:

`c99'
`c9x'
`iso9899:1999'
`iso9899:199x'

ISO C99. Note that this standard is not yet fully supported; see http://gcc.gnu.org/c99status.html for more information. The names `c9x' and `iso9899:199x' are deprecated.

And also:

`gnu99'
`gnu9x'

GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC, this will become the default. The name `gnu9x' is deprecated.


Perhaps because it still isn't fully implemented - see C99 status.

It also could be argued C99 features haven't been widely adopted, although that's something of a circular argument.


Use the command c99 to compile C programs.

The current POSIX standard specifies the command c99, so it should be available in most Unix-like systems.


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜