16 Library introduction [library]

16.4 Library-wide requirements [requirements]

16.4.3 Using the library [using]

16.4.3.1 Overview [using.overview]

Subclause [using] describes how a C++ program gains access to the facilities of the C++ standard library.
[using.headers] describes effects during translation phase 4, while [using.linkage] describes effects during phase 8.

16.4.3.2 Headers [using.headers]

The entities in the C++ standard library are defined in headers, whose contents are made available to a translation unit when it contains the appropriate #include preprocessing directive ([cpp.include]) or the appropriate import declaration ([module.import]).
A translation unit may include library headers in any order ([lex.separate]).
Each may be included more than once, with no effect different from being included exactly once, except that the effect of including either <cassert> or <assert.h> depends each time on the lexically current definition of NDEBUG.174
A translation unit shall include a header only outside of any declaration or definition and, in the case of a module unit, only in its global-module-fragment, and shall include the header or import the corresponding header unit lexically before the first reference in that translation unit to any of the entities declared in that header.
No diagnostic is required.
This is the same as the C standard library.
 

16.4.3.3 Linkage [using.linkage]

Entities in the C++ standard library have external linkage.
Unless otherwise specified, objects and functions have the default extern "C++" linkage ([dcl.link]).
Whether a name from the C standard library declared with external linkage has extern "C" or extern "C++" linkage is implementation-defined.
It is recommended that an implementation use extern "C++" linkage for this purpose.175
Objects and functions defined in the library and required by a C++ program are included in the program prior to program startup.
The only reliable way to declare an object or function signature from the C standard library is by including the header that declares it, notwithstanding the latitude granted in 7.1.4 of the C Standard.