C11 的 __STDC_VERSION__ 值是多少? [英] What is the __STDC_VERSION__ value for C11?
问题描述
我知道编译器使用 __STDC__
来表明编译器是标准 C,并且从那里,您可以使用 __STDC_VERSION__
来确定哪个级别 您正在使用的标准.
I know that compilers use __STDC__
to indicate that a compiler is standard C and, from, there, you can use __STDC_VERSION__
to figure out which level of the standard you're using.
我也知道C90没有价值,C90修正1有199401L
,C99有199901L
.
I also know that C90 had no value, C90 amendment 1 had 199401L
and C99 had 199901L
.
最新的 C1x 草案我简单地将其声明为 201ymmL
,并且我假设它在最终标准中的值不那么模糊".
The latest C1x draft I have simply states it as 201ymmL
and I'm assuming it was made a less "vague" value in the final standard.
我的猜测是它会是 201112L
,因为那是 C11 被批准的时候,但我想确定一下.
My guess is that it will be 201112L
since that's when C11 was ratified but I'd like to be certain.
我想我可以尝试使用 gcc -std=c1x
,但我正在运行的 gcc
版本还不支持.
I thought I could try using gcc -std=c1x
but the version of gcc
I'm running doesn't support that yet.
有谁知道实际值是多少?
Does anyone know what the actual value is?
推荐答案
在gcc
中加上-std=c11
,201112L
用于__STDC_VERSION__
2011 年 12 月 20 日在 gcc
ml 上查看此 gcc
补丁:
See this gcc
patch on December 20, 2011 on gcc
ml:
https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg23572.html
请注意,显然 C11 的 ISO 版本忘记更新草案中的 201ymmL
.
And note that apparently the ISO version of C11 forgot to update the 201ymmL
from the Draft.
预期的最终 __STDC_VERSION__
值 201112L
也已实现(编辑器在发送文档以供发布之前忘记更新 201ymmL
占位符由 ISO).
The intended final
__STDC_VERSION__
value,201112L
, is also implemented (the editor forgot to update the201ymmL
placeholders before sending the document for publication by ISO).
另请参阅 DR #411,这使得预期值是 201112l
成为正式的.编辑说 "委员会正试图将其批准为尽快TC.".(TC =技术勘误")
See also DR #411, which makes it official that the intended value is 201112l
. The editor has said that "The committee is trying to get it approved as a TC as soon as possible.". (TC = "Technical Corrigendum")
编辑(2012 年 7 月 16 日): 技术勘误 1 (ISO/IEC 9899:2011/Cor 1:2012) 于 2012 年 7 月 15 日发布,将 __STDC_VERSION__
修复为 201112L
.
EDIT (July 16, 2012): Technical Corrigendum 1 (ISO/IEC 9899:2011/Cor 1:2012) released on July 15, 2012 fixes the __STDC_VERSION__
to 201112L
.
这篇关于C11 的 __STDC_VERSION__ 值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!