经常在 SO(和其他地方)上,我看到 C++ 标准中的注释和示例不是规范的说法 - 我自己可能已经多次提出这种说法。
但是,我在 C++ 标准的核心语言规范中找不到这一事实的证据(目前我正在查看 C++14 的 n3979 工作草案)。
我能找到的最接近的引述在第 17.5.1.2/2 段中:
Paragraphs labeled “Note(s):” or “Example(s):” are informative, other paragraphs are normative.
但是,除非我弄错了,否则该段仅适用于库部分(即第 18 至 30 条和附录 D)。
因此问题是:C++ 标准中的所有注释和示例都是非规范性的吗?脚注呢?
最佳答案
参见 ISO/IEC Directives Part 2 的 §6.5 .注释、示例和脚注都被视为“信息性”,而不是“规范性”。
关于注释和示例:
Notes and examples integrated in the text of a document shall only be used for giving additional information intended to assist the understanding or use of the document. They shall not contain requirements ("shall"; see 3.3.1 and Table H.1) or any information considered indispensable for the use of the document, e.g. instructions (imperative; see Table H.1), recommendations ("should"; see 3.3.2 and Table H.2) or permission ("may"; see Table H.3). Notes may be written as a statement of fact.
对于脚注:
Footnotes to the text give additional information; their use shall be kept to a minimum. As is the case for notes and examples integrated in the text (see 6.5.1) footnotes shall not contain requirements or any information considered indispensable for the use of the document.
但是,请注意,图和表的脚注可以包含要求。
关于c++ - C++ 标准的核心语言规范中的注释和示例是否非规范?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21364398/