5

Everything is in the title, I searched a lot but cannot find what is the standard that uses my compiler is it C89 C90 C99 or C11 ... I mean when we do not specify the -std option ( the default one) ?

user12448
  • 511
  • 1
  • 4
  • 12

2 Answers2

9

When in doubt, consult the documentation. The gcc man-page makes it clear that -std=gnu89 is the default for C code, and -std=gnu++98 is the default for C++ code. The meaning of these options is described both in the man page and, in much more detail, in the extensive info documentation that is also available online.

These defaults for these flags have changed before and will change again, so it is best to check before assuming specific values.

UPDATE
The defaults have changed over the years. As of GCC 8.3.0, released in February 2019, the default standard for C is -std=gnu11, and -std=gnu++14 for C++. To be sure, look at the documentation of the compiler version you are actually using.

user4815162342
  • 141,790
  • 18
  • 296
  • 355
  • Thanks to you I found what I was looking for **gnu89 GNU dialect of ISO C90 (including some C99 features). This is the default for C code.** :D – user12448 Dec 15 '14 at 23:42
5

gcc comes with extensive documentation.

Type info gcc and read the "Standards" section of the manual.

For most recent compilers (going back quite a few years), the default is -std=gnu90, which implements the 1990 ISO C standard (equivalent to the 1989 ANSI C standard) with some GNU-specific extensions.

(I'd point you to the gcc manual on the web, but that would document the latest version, not the one you're using. I presume your documentation is for the same version you're using.)

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631