tmp/tmp4jupcfxm/{from.md → to.md}
RENAMED
|
@@ -2,74 +2,56 @@
|
|
| 2 |
|
| 3 |
Each element of the C++ standard library is declared or defined (as
|
| 4 |
appropriate) in a *header*.[^14]
|
| 5 |
|
| 6 |
The C++ standard library provides the *C++ library headers*, shown in
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
**Table: C++library headers** <a id="tab:cpp.library.headers">[tab:cpp.library.headers]</a>
|
| 10 |
-
|
| 11 |
-
| | | | |
|
| 12 |
-
| ---------------------- | -------------------- | -------------------- | ----------------- |
|
| 13 |
-
| `<algorithm>` | `<future>` | `<numeric>` | `<strstream>` |
|
| 14 |
-
| `<any>` | `<initializer_list>` | `<optional>` | `<system_error>` |
|
| 15 |
-
| `<array>` | `<iomanip>` | `<ostream>` | `<thread>` |
|
| 16 |
-
| `<atomic>` | `<ios>` | `<queue>` | `<tuple>` |
|
| 17 |
-
| `<bitset>` | `<iosfwd>` | `<random>` | `<type_traits>` |
|
| 18 |
-
| `<chrono>` | `<iostream>` | `<ratio>` | `<typeindex>` |
|
| 19 |
-
| `<codecvt>` | `<istream>` | `<regex>` | `<typeinfo>` |
|
| 20 |
-
| `<complex>` | `<iterator>` | `<scoped_allocator>` | `<unordered_map>` |
|
| 21 |
-
| `<condition_variable>` | `<limits>` | `<set>` | `<unordered_set>` |
|
| 22 |
-
| `<deque>` | `<list>` | `<shared_mutex>` | `<utility>` |
|
| 23 |
-
| `<exception>` | `<locale>` | `<sstream>` | `<valarray>` |
|
| 24 |
-
| `<execution>` | `<map>` | `<stack>` | `<variant>` |
|
| 25 |
-
| `<filesystem>` | `<memory>` | `<stdexcept>` | `<vector>` |
|
| 26 |
-
| `<forward_list>` | `<memory_resource>` | `<streambuf>` | |
|
| 27 |
-
| `<fstream>` | `<mutex>` | `<string>` | |
|
| 28 |
-
| `<functional>` | `<new>` | `<string_view>` | |
|
| 29 |
-
|
| 30 |
|
| 31 |
The facilities of the C standard library are provided in the additional
|
| 32 |
-
headers shown in
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
| `<cassert>` | `<cinttypes>` | `<csignal>` | `<cstdio>` | `<cwchar>` |
|
| 39 |
-
| `<ccomplex>` | `<ciso646>` | `<cstdalign>` | `<cstdlib>` | `<cwctype>` |
|
| 40 |
-
| `<cctype>` | `<climits>` | `<cstdarg>` | `<cstring>` | |
|
| 41 |
-
| `<cerrno>` | `<clocale>` | `<cstdbool>` | `<ctgmath>` | |
|
| 42 |
-
| `<cfenv>` | `<cmath>` | `<cstddef>` | `<ctime>` | |
|
| 43 |
-
| `<cfloat>` | `<csetjmp>` | `<cstdint>` | `<cuchar>` | |
|
| 44 |
|
|
|
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
Names which are defined as macros in C shall be defined as macros in the
|
| 59 |
C++ standard library, even if C grants license for implementation as
|
| 60 |
functions.
|
| 61 |
|
| 62 |
-
[*Note
|
| 63 |
`assert`, `offsetof`, `setjmp`, `va_arg`, `va_end`, and
|
| 64 |
`va_start`. — *end note*]
|
| 65 |
|
| 66 |
Names that are defined as functions in C shall be defined as functions
|
| 67 |
in the C++ standard library.[^16]
|
| 68 |
|
| 69 |
-
Identifiers that are keywords or operators in C++shall not be defined
|
| 70 |
-
macros in C++standard library headers.[^17]
|
| 71 |
|
| 72 |
[[depr.c.headers]], C standard library headers, describes the effects of
|
| 73 |
using the `name.h` (C header) form in a C++ program.[^18]
|
| 74 |
|
| 75 |
Annex K of the C standard describes a large number of functions, with
|
|
@@ -80,34 +62,9 @@ service as the C library function with the unsuffixed name, but
|
|
| 80 |
generally take an additional argument whose value is the size of the
|
| 81 |
result array. If any C++ header is included, it is
|
| 82 |
*implementation-defined* whether any of these names is declared in the
|
| 83 |
global namespace. (None of them is declared in namespace `std`.)
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
**Table: C standard Annex K names** <a id="tab:c.annex.k.names">[tab:c.annex.k.names]</a>
|
| 90 |
-
|
| 91 |
-
| | | | |
|
| 92 |
-
| ---------------------- | -------------------------- | -------------- | ------------- |
|
| 93 |
-
| `abort_handler_s` | `mbstowcs_s` | `strncat_s` | `vswscanf_s` |
|
| 94 |
-
| `asctime_s` | `memcpy_s` | `strncpy_s` | `vwprintf_s` |
|
| 95 |
-
| `bsearch_s` | `memmove_s` | `strtok_s` | `vwscanf_s` |
|
| 96 |
-
| `constraint_handler_t` | `memset_s` | `swprintf_s` | `wcrtomb_s` |
|
| 97 |
-
| `ctime_s` | `printf_s` | `swscanf_s` | `wcscat_s` |
|
| 98 |
-
| `errno_t` | `qsort_s` | `tmpfile_s` | `wcscpy_s` |
|
| 99 |
-
| `fopen_s` | `RSIZE_MAX` | `TMP_MAX_S` | `wcsncat_s` |
|
| 100 |
-
| `fprintf_s` | `rsize_t` | `tmpnam_s` | `wcsncpy_s` |
|
| 101 |
-
| `freopen_s` | `scanf_s` | `vfprintf_s` | `wcsnlen_s` |
|
| 102 |
-
| `fscanf_s` | `set_constraint_handler_s` | `vfscanf_s` | `wcsrtombs_s` |
|
| 103 |
-
| `fwprintf_s` | `snprintf_s` | `vfwprintf_s` | `wcstok_s` |
|
| 104 |
-
| `fwscanf_s` | `snwprintf_s` | `vfwscanf_s` | `wcstombs_s` |
|
| 105 |
-
| `getenv_s` | `sprintf_s` | `vprintf_s` | `wctomb_s` |
|
| 106 |
-
| `gets_s` | `sscanf_s` | `vscanf_s` | `wmemcpy_s` |
|
| 107 |
-
| `gmtime_s` | `strcat_s` | `vsnprintf_s` | `wmemmove_s` |
|
| 108 |
-
| `ignore_handler_s` | `strcpy_s` | `vsnwprintf_s` | `wprintf_s` |
|
| 109 |
-
| `L_tmpnam_s` | `strerror_s` | `vsprintf_s` | `wscanf_s` |
|
| 110 |
-
| `localtime_s` | `strerrorlen_s` | `vsscanf_s` | |
|
| 111 |
-
| `mbsrtowcs_s` | `strlen_s` | `vswprintf_s` | |
|
| 112 |
-
|
| 113 |
|
|
|
|
| 2 |
|
| 3 |
Each element of the C++ standard library is declared or defined (as
|
| 4 |
appropriate) in a *header*.[^14]
|
| 5 |
|
| 6 |
The C++ standard library provides the *C++ library headers*, shown in
|
| 7 |
+
[[headers.cpp]].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
The facilities of the C standard library are provided in the additional
|
| 10 |
+
headers shown in [[headers.cpp.c]]. [^15]
|
| 11 |
|
| 12 |
+
The headers listed in [[headers.cpp]], or, for a freestanding
|
| 13 |
+
implementation, the subset of such headers that are provided by the
|
| 14 |
+
implementation, are collectively known as the
|
| 15 |
+
*importable C++ library headers*.
|
| 16 |
|
| 17 |
+
[*Note 1*: Importable C++ library headers can be imported as module
|
| 18 |
+
units [[module.import]]. — *end note*]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
[*Example 1*:
|
| 21 |
|
| 22 |
+
``` cpp
|
| 23 |
+
import <vector>; // imports the <vector> header unit
|
| 24 |
+
std::vector<int> vi; // OK
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
— *end example*]
|
| 28 |
+
|
| 29 |
+
Except as noted in [[library]] through [[thread]] and [[depr]], the
|
| 30 |
+
contents of each header `cname` is the same as that of the corresponding
|
| 31 |
+
header `name.h` as specified in the C standard library [[intro.refs]].
|
| 32 |
+
In the C++ standard library, however, the declarations (except for names
|
| 33 |
+
which are defined as macros in C) are within namespace scope
|
| 34 |
+
[[basic.scope.namespace]] of the namespace `std`. It is unspecified
|
| 35 |
+
whether these names (including any overloads added in [[support]]
|
| 36 |
+
through [[thread]] and [[depr]]) are first declared within the global
|
| 37 |
+
namespace scope and are then injected into namespace `std` by explicit
|
| 38 |
+
*using-declaration*s [[namespace.udecl]].
|
| 39 |
|
| 40 |
Names which are defined as macros in C shall be defined as macros in the
|
| 41 |
C++ standard library, even if C grants license for implementation as
|
| 42 |
functions.
|
| 43 |
|
| 44 |
+
[*Note 2*: The names defined as macros in C include the following:
|
| 45 |
`assert`, `offsetof`, `setjmp`, `va_arg`, `va_end`, and
|
| 46 |
`va_start`. — *end note*]
|
| 47 |
|
| 48 |
Names that are defined as functions in C shall be defined as functions
|
| 49 |
in the C++ standard library.[^16]
|
| 50 |
|
| 51 |
+
Identifiers that are keywords or operators in C++ shall not be defined
|
| 52 |
+
as macros in C++ standard library headers.[^17]
|
| 53 |
|
| 54 |
[[depr.c.headers]], C standard library headers, describes the effects of
|
| 55 |
using the `name.h` (C header) form in a C++ program.[^18]
|
| 56 |
|
| 57 |
Annex K of the C standard describes a large number of functions, with
|
|
|
|
| 62 |
generally take an additional argument whose value is the size of the
|
| 63 |
result array. If any C++ header is included, it is
|
| 64 |
*implementation-defined* whether any of these names is declared in the
|
| 65 |
global namespace. (None of them is declared in namespace `std`.)
|
| 66 |
|
| 67 |
+
[[c.annex.k.names]] lists the Annex K names that may be declared in some
|
| 68 |
+
header. These names are also subject to the restrictions of
|
| 69 |
+
[[macro.names]].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|