是否需要在C11中提供附件K的支持

是否需要在C11中提供附件K的支持

本文介绍了为了实现一致的实施,是否需要在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段:

带脚注:

第3段说:

这就是为什么没有必要在库部分的第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的支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 08:37