为了实现一致的实施,是否需要在C11中提供附件K的支持? [英] Is support of Annex K in C11 required for a conforming implementation?

查看:101
本文介绍了为了实现一致的实施,是否需要在C11中提供附件K的支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

回答一个问题,该问题利用了一些我认为是的功能(sscanf_ssprintf_s)丹尼尔·菲舍尔(Daniel Fischer)引起了我的注意,它不是标准C,而是有关的功能在附件K中定义.

While answering a question that made use of some functions (sscanf_s and sprintf_s) that I thought were not standard C, Daniel Fischer brought to my attention that the functions in question were defined in Annex K.

我一般理解规范性意味着它有助于定义标准.但是,传统上C标准的附件仅被视为提供信息.附件K在C11标准中被标记为规范性文件.它定义了安全"功能.

I understand generally that normative means it helps define the standard. But, an annex to the C Standard has traditionally been treated as informative only. Annex K is labeled as normative in the C11 Standard. It defines "safe" functions.

这是否意味着不提供这些功能的编译器不符合C11标准?

我只有我可以使用的C11标准草案,但是它指出附件K是规范性的,但是该标准的库部分未提及附件K中讨论的功能.定义中的注释运行时约束似乎暗示附件K定义了扩展名.

I only have the draft C11 Standard available to me, but it states that Annex K is normative, but the library section of the standard makes no mention of the functions discussed in Annex K. A note in the definition of runtime-constraint seems to imply Annex K defines an extension.

规范性附件仅定义可选扩展名吗?

推荐答案

附件K是可选的;它本身就是这样.

Annex K is optional; it says so itself.

请参阅K.2第2段:

定义__STDC_LIB_EXT1__的实现应符合 附件中的规范.

An implementation that defines __STDC_LIB_EXT1__ shall conform to the specifications in this annex.

带脚注:

未定义__STDC_LIB_EXT1__的实现不需要符合这些要求 规格.

Implementations that do not define __STDC_LIB_EXT1__ are not required to conform to these specifications.

第3段说:

第K.3节应被理解为好像已合并到并行中 条款7的命名子句的结构.

Subclause K.3 should be read as if it were merged into the parallel structure of named subclauses of clause 7.

这就是为什么没有必要在库部分的第7条中提到它的原因(或者至少该标准的作者认为没有必要).

which is why it's not necessary to mention it in the library section, clause 7 (or at least the authors of the standard didn't feel it was necessary).

定义__STDC_LIB_EXT1__的实现必须将其定义为201112L; N1570和已发布的C11标准都错了,但已在技术勘误中修复.

An implementation that defines __STDC_LIB_EXT1__ must define it as 201112L; both N1570 and the released C11 standard got this wrong, but it was fixed in a Technical Corrigendum.

这篇关于为了实现一致的实施,是否需要在C11中提供附件K的支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆