C11 的 __STDC_VERSION__ 值是多少?
我知道编译器使用 __STDC__
来指示编译器是标准 C,从那里,您可以使用 __STDC_VERSION__
来找出哪个级别您正在使用的标准。
我还知道C90没有价值,C90修正案1有199401L
,C99有199901L
。
我最新的 C1x 草案只是将其表述为 201ymmL
,并且我假设它在最终标准中被制定为一个不太“模糊”的值。
我的猜测是 201112L
,因为 C11 就是在那时获得批准的,但我想确定一下。
我想我可以尝试使用 gcc -std=c1x
但我正在运行的 gcc
版本尚不支持。
有谁知道实际价值是多少?
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.
I also know that C90 had no value, C90 amendment 1 had 199401L
and C99 had 199901L
.
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.
My guess is that it will be 201112L
since that's when C11 was ratified but I'd like to be certain.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于
gcc
中的-std=c11
,201112L
用于__STDC_VERSION__
请参阅此
gcc
2011 年 12 月 20 日在gcc
上的补丁 ml:https://www.mail-archive.com/[email protected]/msg23572.html
请注意,显然 C11 的 ISO 版本忘记更新草案中的
201ymmL
。另请参阅 DR #411,这使得官方表示预期值为
201112l
。编辑表示“委员会正在努力将其批准为 TC尽快。”。 (TC =“技术勘误表”)编辑(2012 年 7 月 16 日):技术勘误表 1 (ISO/IEC 9899:2011/Cor 1:2012)于 2012 年 7 月 15 日发布,将
__STDC_VERSION__
修复为201112L
。With
-std=c11
ingcc
,201112L
is used for__STDC_VERSION__
See this
gcc
patch on December 20, 2011 ongcc
ml:https://www.mail-archive.com/[email protected]/msg23572.html
And note that apparently the ISO version of C11 forgot to update the
201ymmL
from the Draft.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")EDIT (July 16, 2012): Technical Corrigendum 1 (ISO/IEC 9899:2011/Cor 1:2012) released on July 15, 2012 fixes the
__STDC_VERSION__
to201112L
.根据 GCC 邮件列表的这篇帖子,最终值为,正如您所怀疑的,
201112L
。According to this post to the GCC mailing list, the final value is, as you suspected,
201112L
.