Files
2025-10-25 03:02:53 +03:00

91 lines
3.9 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[std.modules]
# 16 Library introduction [[library]](./#library)
## 16.4 Library-wide requirements [[requirements]](requirements#std.modules)
### 16.4.2 Library contents and organization [[organization]](organization#std.modules)
#### 16.4.2.4 Modules [std.modules]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1513)
The C++ standard library provides
the following [*C++ library modules*](#def:C++_library_modules "16.4.2.4Modules[std.modules]")[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1517)
The named module std exports declarations in namespace std that are provided by the importable C++ library headers
(Table [24](headers#tab:headers.cpp "Table 24: C++ library headers") or the subset provided by a freestanding implementation)
and the C++ headers for C library facilities (Table [25](headers#tab:headers.cpp.c "Table 25: C++ headers for C library facilities"))[.](#2.sentence-1)
It additionally exports declarations in the global namespace
for the storage allocation and deallocation functions
that are provided by [<new>](support.dynamic.general#header:%3cnew%3e "17.6.1General[support.dynamic.general]")[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1526)
The named module std.compat exports the same declarations as
the named module std, and
additionally exports
- [(3.1)](#3.1)
declarations in the global namespace
corresponding to the declarations in namespace std that are provided by
the C++ headers for C library facilities (Table [25](headers#tab:headers.cpp.c "Table 25: C++ headers for C library facilities")),
except the explicitly excluded declarations
described in [[support.c.headers.other]](support.c.headers.other "17.15.7Other C headers") and
- [(3.2)](#3.2)
declarations provided by
the headers [<stdbit.h>](stdbit.h.syn#header:%3cstdbit.h%3e "22.12Header <stdbit.h> synopsis[stdbit.h.syn]") and [<stdckdint.h>](stdckdint.h.syn#header:%3cstdckdint.h%3e "29.11.1Header <stdckdint.h> synopsis[stdckdint.h.syn]")[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1543)
It is unspecified to which module a declaration in the standard library
is attached[.](#4.sentence-1)
[*Note [1](#note-1)*:
Conforming implementations ensure that mixing#include and import does not result in
conflicting attachments ([[basic.link]](basic.link "6.7Program and linkage"))[.](#4.sentence-2)
— *end note*]
*Recommended practice*: Implementations should ensure such attachments do not preclude
further evolution or decomposition of the standard library modules[.](#4.sentence-3)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1555)
A declaration in the standard library denotes the same entity regardless of
whether it was made reachable through
including a header,
importing a header unit, or
importing a C++ library module[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1562)
*Recommended practice*: Implementations should avoid exporting any other declarations
from the C++ library modules[.](#6.sentence-1)
[*Note [2](#note-2)*:
Like all named modules, the C++ library modules
do not make macros visible ([[module.import]](module.import "10.3Import declaration")), such asassert ([[cassert.syn]](cassert.syn "19.3.2Header <cassert> synopsis")),errno ([[cerrno.syn]](cerrno.syn "19.4.2Header <cerrno> synopsis")),offsetof ([[cstddef.syn]](cstddef.syn "17.2.1Header <cstddef> synopsis")), andva_arg ([[cstdarg.syn]](cstdarg.syn "17.14.2Header <cstdarg> synopsis"))[.](#6.sentence-2)
— *end note*]