Are notes and examples in the core language specification of the C++ Standard non-normative?

后端 未结 3 2001
无人及你
无人及你 2020-11-30 11:10

Often on SO (and elsewhere) I have seen the claim that notes and examples in the C++ Standard are not normative - I have probably made this claim myself a few times

相关标签:
3条回答
  • 2020-11-30 11:32

    The way the Standard is written, all that is required for an implementation to be conforming is that it be capable of processing at least one--possibly contrived and useless--program. For any implementation to actually be useful for anything, however, it must go beyond the bare requirements given by the Standard.

    While an implementation need not behave in a fashion consistent with the examples to be conforming, implementations which do so should generally be considered superior to those that don't. Whether an implementation that fails to do so should be regarded as being of sufficient quality to be useful for some particular purpose would depend upon the purpose in question and the reason for failure.

    0 讨论(0)
  • 2020-11-30 11:36

    See §6.5 of the ISO/IEC Directives Part 2. Notes, examples, and footnotes are all considered "informational", as opposed to "normative".

    For notes and examples:

    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.

    For footnotes:

    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.

    However, note that footnotes to figures and tables can contain requirements.

    0 讨论(0)
  • 2020-11-30 11:42

    This is generic for all ISO standard documents:

    An example integrated in the text of a document, used for giving additional information intended to assist the understanding or use of the document. In ISO standards, examples are without exception non-normative.

    A similar clause applies to notes:

    A note integrated in the text of a document, used for giving additional information intended to assist the understanding or use of the document. In ISO standards, notes are without exception non-normative.

    0 讨论(0)
提交回复
热议问题