C99 not default C- version for GCC?
Asked Answered
D

4

11

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?

Decaliter answered 20/2, 2011 at 23:16 Comment(0)
R
10

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.

Rivero answered 20/2, 2011 at 23:19 Comment(1)
gcc5 will use gnu11 as default version.Abductor
C
10

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.

Coachwork answered 20/2, 2011 at 23:22 Comment(0)
B
10

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.

Bioastronautics answered 26/2, 2011 at 1:43 Comment(0)
L
2

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.

Lucaslucca answered 11/3, 2015 at 18:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.