gpt4 book ai didi

c++ - 我们能否将规范性引用中未明确引用的内容应用于 C++ 标准?

转载 作者:IT老高 更新时间:2023-10-28 21:47:47 25 4
gpt4 key购买 nike

在 C++11 标准 ( closest draft is N3337 ) 部分 1.2 规范性引用 说:

The following referenced documents are indispensable for the application of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

但没有关于如何应用引用的指南。最简单的情况是 C++11 显式引用引用,例如在 3.9.1 基本类型部分中它说:

[...]The signed and unsigned integer types shall satisfy the constraints given in the C standard, section 5.2.4.2.1.

但是其他没有明确引用的情况呢?例如,C++11 使用了 indeterminate value 这个词,但它没有定义这个术语。规范性引用文献包括:

— ISO/IEC 9899:1999, Programming languages — C

[...]

— ISO/IEC 9899:1999/Cor.3:2007(E), Programming languages — C, Technical Corrigendum 3

和 C99( draft c99 standard ) 在 3.17.2 部分确实有 indeterminate value 的定义:

either an unspecified value or a trap representation

indeterminate value 是通过引用 C99 来定义 C++11 是否正确,如 this answer seems to do for the definition of bit ?如果是,那么 trap 表示 呢在 C99 中?

慷慨的解读是,只要 C++11 中没有任何内容与规范性引用相冲突,那么它就适用,这是正确的解释吗? What is indeterminate behavior in C++ ? How is it different from undefined behavior? 的一些答案似乎暗示了一个慷慨的阅读,虽然在一些答案中语言有点松散,所以很难说出在某些点上究竟声称了什么。

最佳答案

ISO 标准文档的规范性引用部分的功能在ISO/IEC Directives, Part 2, 2011 中定义。 §6.2.2:

6.2.2 Normative references

This conditional element shall give a list of the referenced documents cited (see 6.6.7.5) in the document in such a way as to make them indispensable for the application of the document. For dated references, each shall be given with its year of publication, or, in the case of enquiry or final drafts, with a dash together with a footnote “To be published.”, and full title. The year of publication or dash shall not be given for undated references. When an undated reference is to all parts of a document, the publication number shall be followed by the indication “(all parts)” and the general title of the series of parts (i.e. the introductory and main elements, see Annex E).

In principle, the referenced documents shall be documents published by ISO and/or IEC. Documents published by other bodies may be referred to in a normative manner provided that

a) the referenced document is recognized by the ISO and/or IEC committee concerned as having wide acceptance and authoritative status as well as being publicly available,

b) the ISO and/or IEC committee concerned has obtained the agreement of the authors or publishers (where known) of the referenced document to its inclusion and to its being made available as required — the authors or publishers will be expected to make available such documents on request,

c) the authors or publishers (where known) have also agreed to inform the ISO and/or IEC committee concerned of their intention to revise the referenced document and of the points the revision will concern, and

d) the ISO and/or IEC committee concerned undertakes to review the situation in the light of any changes in the referenced document.

The list shall be introduced by the following wording:

“The following documents, in whole or in part, are normatively referenced in this document and are indispensable for its application. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.”

上述措辞也适用于多部分文档的一部分。

该列表不应包括以下内容:

  • 未公开的引用文件;

  • 仅以提供信息的方式引用的引用文件;

  • 在准备文件时仅作为书目或背景 Material 的引用文件。

此类引用文件可能会列在引用书目中(参见 6.4.2)。

值得注意的是,它并没有说引用文档的内容被合并到当前文档中。本质上,它作为所有其他标准文档的列表,在文档中以某种方式规范地引用了其他地方

因此,并非 C99 中的所有内容都被合并到 C++11 中 - 只有 C99 的那些部分被特别引用为被合并到 C++11 标准中。

关于c++ - 我们能否将规范性引用中未明确引用的内容应用于 C++ 标准?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23020323/

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