gpt4 book ai didi

c - 符合要求的实现是否需要支持 C11 中的附件 K?

转载 作者:太空狗 更新时间:2023-10-29 17:05:43 26 4
gpt4 key购买 nike

同时 answering a question它使用了一些我认为不是标准 C 的函数(sscanf_ssprintf_s),Daniel Fischer 提醒我这些函数在附件 K 中定义。

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

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

我只有 C11 标准草案可供使用,但它声明 Annex K 是规范性的,但该标准的库部分没有提及 Annex K 中讨论的功能。 定义中的注释runtime-constraint 似乎暗示 Annex K 定义了一个扩展。

规范性附件是否只定义可选扩展?

最佳答案

附件 K 是可选的;它自己是这么说的。

参见 K.2 第 2 段:

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

带脚注:

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

第 3 段说:

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

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

定义__STDC_LIB_EXT1__的实现必须将其定义为201112L; N1570 和发布的 C11 标准都犯了这个错误,但它在技术勘误中得到了修复。

关于c - 符合要求的实现是否需要支持 C11 中的附件 K?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16700541/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com