Guillaume D
Guillaume D

Reputation: 2346

Is there a command line involving gcc to know which --std=xxx it is using?

I can choose to call

gcc --std=c99 toto.c -o toto.elf

But in my case, I would like to know which --std is used by default when calling

gcc toto.c -o toto.elf

Note for closing request: I refute the idea that this topic is a duplicate, in fact, what I want is not only knowing what the default --std is but also what --std is currently used and how make difference between std=gnu11 and std=c11. Sure that my first post was leading people in error.

Upvotes: 1

Views: 159

Answers (2)

Lundin
Lundin

Reputation: 214860

  • Everything prior version 5.0.0 has -std=gnu90 as default.
  • Everything between version 5.0.0 and 8.0.0 has -std=gnu11 as default.
  • Everything past 8.0.0 has -std=gnu17 as default.

So you only need to check --version. However, the __STDC_VERSION__ should also correspond to the -std=cxx even when compiling with GNU extensions.

Upvotes: 2

Guillaume D
Guillaume D

Reputation: 2346

i found this gcc -dM -E - < /dev/null | grep 'STDC_VERSION'

Upvotes: 3

Related Questions