I know that for C11, I can test #if(__STDC_VERSION >= 20112L). But for -std=c1x
what macro and/or value should I test it?
what’s the nomenclature of this standard? or maybe a informal name, if any.
I hope this is clear. Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
gcc’s
-std=c1xoption is synonymous with-std=c11, and it sets__STDC_VERSION__to the same value,201112L(note: not20112L).Before it was released, the new C standard was referred to as “C1X” (since it wasn’t known exactly when it would come out), and gcc added a
-std=c1xoption to enable partial support for the upcoming standard. When the standard was released as C11, gcc added-std=c11to enable (still partial) support, but has kept the-std=c1xoption for compatibility.(Due to an editing error, the released 2011 ISO C standard doesn’t specify the value of
__STDC_VERSION__, but the editor has stated that201112Lis correct; see this question.)Jens Gustedt’s comment makes a good point.
gcc -std=c11sets__STDC_VERSION__to201112LL, which is supposed to imply C11 conformance, but in fact it’s still missing a log of C11 features. We can expect this to improve in future releases.Similarly,
-std=c99sets__STDC_VERSION__to199901L, but it doesn’t quite conform to the C99 standard (the current status is documented here. gcc’s C90 conformance (with-ansior-std=c90) conforms quite well to the C90 standard.