The set of
consists of all syntactic and semantic rules in this document
except for those rules containing an explicit notation that
“no diagnostic is required” or which are described as resulting in
Although this document states only requirements on C++
implementations, those requirements are often easier to understand if
they are phrased as requirements on programs, parts of programs, or
execution of programs.
If a program contains no violations of the rules in
[lex] through [thread] and [depr],
a conforming implementation shall,
within its resource limits as described in [implimits],
accept and correctly execute3
Otherwise, if a program contains a violation of any diagnosable rule or an occurrence
of a construct described in this document as “conditionally-supported” when
the implementation does not support that construct, a conforming implementation
shall issue at least one diagnostic message.
A C++ translation unit ([lex.phases])
obtains access to the names defined in the library by
including the appropriate standard library header or importing
the appropriate standard library named header unit ([using.headers]).
implementation is one in which execution may take place without the benefit of
an operating system.
A hosted implementation
supports all the facilities described in this document, while
a freestanding implementation
supports the entire C++ language
described in [lex] through [cpp] and
the subset of the library facilities described in [compliance].
A conforming implementation executing a well-formed program shall
produce the same observable behavior as one of the possible executions
of the corresponding instance of the abstract machine with the
same program and the same input.
However, if any such execution contains an undefined operation, this document places no
requirement on the implementation executing that program with that input
(not even with regard to operations preceding the first undefined
This provision is
sometimes called the “as-if” rule, because an implementation is free to
disregard any requirement of this document as long as the result
is as if the requirement had been obeyed, as far as can be determined
from the observable behavior of the program.
For instance, an actual
implementation need not evaluate part of an expression if it can deduce that its
value is not used and that no
side effects affecting the
observable behavior of the program are produced.