Question

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.

However, I could not find evidence of this fact in the core language specification of the C++ Standard (at the moment I am looking at the n3979 Working Draft for C++14).

The closest quote I could find is in paragraph 17.5.1.2/2:

Paragraphs labeled “Note(s):” or “Example(s):” are informative, other paragraphs are normative.

However, unless I'm mistaken that paragraph only applies to the Library part (i.e. Clauses 18 through 30 and Annex D).

Hence the question: Are all notes and examples in the C++ Standard non-normative? How about footnotes?

Était-ce utile?

La solution

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.

Autres conseils

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.

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top