Search code examples
gccstandards

GCC: C standard being used


Instead of going through a list of of possible standards seeing which doesn't give errors, is there just a simple gcc option I can use (just checked, not likely) or a config file or info file in the system that says?


Solution

  • Use the -std option to control the language standard used. Values of either c89 (which is the same as using -ansi for C code) or c99 are likely what you want, but there are GNU dialects of both, plus others listed in the manpage.

    -std=gnu89 is the default for C, which is "GNU dialect of ISO C90 (including some C99 features)." (ISO's 1990 C standard is ANSI's 1989 standard, known as C89.)