tmp/tmpyzcrwjd5/{from.md → to.md}
RENAMED
|
@@ -36,29 +36,30 @@ namespace std {
|
|
| 36 |
#define offsetof(P, D) see below
|
| 37 |
```
|
| 38 |
|
| 39 |
The contents and meaning of the header `<cstddef>` are the same as the C
|
| 40 |
standard library header `<stddef.h>`, except that it does not declare
|
| 41 |
-
the type `wchar_t`, that it
|
| 42 |
-
|
| 43 |
-
[[support.types.
|
|
|
|
| 44 |
|
| 45 |
-
See also: ISO C 7.
|
| 46 |
|
| 47 |
### Header `<cstdlib>` synopsis <a id="cstdlib.syn">[[cstdlib.syn]]</a>
|
| 48 |
|
| 49 |
``` cpp
|
| 50 |
namespace std {
|
| 51 |
using size_t = see below; // freestanding
|
| 52 |
-
using div_t = see below;
|
| 53 |
-
using ldiv_t = see below;
|
| 54 |
-
using lldiv_t = see below;
|
| 55 |
}
|
| 56 |
|
| 57 |
#define NULL see below // freestanding
|
| 58 |
-
#define EXIT_FAILURE see below
|
| 59 |
-
#define EXIT_SUCCESS see below
|
| 60 |
#define RAND_MAX see below
|
| 61 |
#define MB_CUR_MAX see below
|
| 62 |
|
| 63 |
namespace std {
|
| 64 |
// Exposition-only function type aliases
|
|
@@ -82,18 +83,24 @@ namespace std {
|
|
| 82 |
|
| 83 |
// [c.malloc], C library memory allocation
|
| 84 |
void* aligned_alloc(size_t alignment, size_t size);
|
| 85 |
void* calloc(size_t nmemb, size_t size);
|
| 86 |
void free(void* ptr);
|
|
|
|
|
|
|
| 87 |
void* malloc(size_t size);
|
| 88 |
void* realloc(void* ptr, size_t size);
|
|
|
|
| 89 |
|
| 90 |
double atof(const char* nptr);
|
| 91 |
int atoi(const char* nptr);
|
| 92 |
long int atol(const char* nptr);
|
| 93 |
long long int atoll(const char* nptr);
|
| 94 |
double strtod(const char* nptr, char** endptr);
|
|
|
|
|
|
|
|
|
|
| 95 |
float strtof(const char* nptr, char** endptr);
|
| 96 |
long double strtold(const char* nptr, char** endptr);
|
| 97 |
long int strtol(const char* nptr, char** endptr, int base);
|
| 98 |
long long int strtoll(const char* nptr, char** endptr, int base);
|
| 99 |
unsigned long int strtoul(const char* nptr, char** endptr, int base);
|
|
@@ -105,49 +112,54 @@ namespace std {
|
|
| 105 |
int wctomb(char* s, wchar_t wchar);
|
| 106 |
size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n);
|
| 107 |
size_t wcstombs(char* s, const wchar_t* pwcs, size_t n);
|
| 108 |
|
| 109 |
// [alg.c.library], C standard library algorithms
|
| 110 |
-
void* bsearch(const void* key,
|
| 111 |
c-compare-pred* compar);
|
| 112 |
-
void* bsearch(const void* key,
|
| 113 |
compare-pred* compar);
|
| 114 |
-
void
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
// [c.math.rand], low-quality random number generation
|
| 118 |
int rand();
|
| 119 |
void srand(unsigned int seed);
|
| 120 |
|
| 121 |
// [c.math.abs], absolute values
|
| 122 |
-
constexpr int abs(int j);
|
| 123 |
-
constexpr long int abs(long int j);
|
| 124 |
-
constexpr long long int abs(long long int j);
|
| 125 |
-
constexpr floating-point-type abs(floating-point-type j);
|
| 126 |
|
| 127 |
-
constexpr long int labs(long int j);
|
| 128 |
-
constexpr long long int llabs(long long int j);
|
| 129 |
|
| 130 |
-
constexpr div_t div(int numer, int denom);
|
| 131 |
-
constexpr ldiv_t div(long int numer, long int denom); // see [library.c]
|
| 132 |
-
constexpr lldiv_t div(long long int numer, long long int denom); // see [library.c]
|
| 133 |
-
constexpr ldiv_t ldiv(long int numer, long int denom);
|
| 134 |
-
constexpr lldiv_t lldiv(long long int numer, long long int denom);
|
| 135 |
}
|
| 136 |
```
|
| 137 |
|
| 138 |
The contents and meaning of the header `<cstdlib>` are the same as the C
|
| 139 |
standard library header `<stdlib.h>`, except that it does not declare
|
| 140 |
-
the
|
|
|
|
| 141 |
[[support.types.layout]], [[support.start.term]], [[c.malloc]],
|
| 142 |
[[c.mb.wcs]], [[alg.c.library]], [[c.math.rand]], and [[c.math.abs]].
|
| 143 |
|
| 144 |
[*Note 1*: Several functions have additional overloads in this
|
| 145 |
document, but they have the same behavior as in the C standard library
|
| 146 |
[[library.c]]. — *end note*]
|
| 147 |
|
| 148 |
-
See also: ISO C 7.
|
| 149 |
|
| 150 |
### Null pointers <a id="support.types.nullptr">[[support.types.nullptr]]</a>
|
| 151 |
|
| 152 |
The type `nullptr_t` is a synonym for the type of a `nullptr`
|
| 153 |
expression, and it has the characteristics described in
|
|
@@ -158,11 +170,11 @@ another `nullptr_t` object that is an lvalue can be
|
|
| 158 |
taken. — *end note*]
|
| 159 |
|
| 160 |
The macro `NULL` is an *implementation-defined* null pointer
|
| 161 |
constant.[^1]
|
| 162 |
|
| 163 |
-
See also: ISO C 7.
|
| 164 |
|
| 165 |
### Sizes, alignments, and offsets <a id="support.types.layout">[[support.types.layout]]</a>
|
| 166 |
|
| 167 |
The macro `offsetof(type, member-designator)` has the same semantics as
|
| 168 |
the corresponding macro in the C standard library header `<stddef.h>`,
|
|
@@ -189,15 +201,17 @@ that is large enough to contain the size in bytes of any object
|
|
| 189 |
*Recommended practice:* An implementation should choose types for
|
| 190 |
`ptrdiff_t` and `size_t` whose integer conversion ranks [[conv.rank]]
|
| 191 |
are no greater than that of `signed long int` unless a larger size is
|
| 192 |
necessary to contain all the possible values.
|
| 193 |
|
| 194 |
-
The type `max_align_t` is a
|
| 195 |
-
requirement is at least as great as that of every scalar
|
| 196 |
-
alignment requirement is supported in every context
|
|
|
|
|
|
|
| 197 |
|
| 198 |
-
See also: ISO C 7.
|
| 199 |
|
| 200 |
### `byte` type operations <a id="support.types.byteops">[[support.types.byteops]]</a>
|
| 201 |
|
| 202 |
``` cpp
|
| 203 |
template<class IntType>
|
|
|
|
| 36 |
#define offsetof(P, D) see below
|
| 37 |
```
|
| 38 |
|
| 39 |
The contents and meaning of the header `<cstddef>` are the same as the C
|
| 40 |
standard library header `<stddef.h>`, except that it does not declare
|
| 41 |
+
the type `wchar_t`, that it does not define the macro `unreachable`,
|
| 42 |
+
that it also declares the type `byte` and its associated operations
|
| 43 |
+
[[support.types.byteops]], and as noted in [[support.types.nullptr]] and
|
| 44 |
+
[[support.types.layout]].
|
| 45 |
|
| 46 |
+
See also: ISO C 7.21
|
| 47 |
|
| 48 |
### Header `<cstdlib>` synopsis <a id="cstdlib.syn">[[cstdlib.syn]]</a>
|
| 49 |
|
| 50 |
``` cpp
|
| 51 |
namespace std {
|
| 52 |
using size_t = see below; // freestanding
|
| 53 |
+
using div_t = see below; // freestanding
|
| 54 |
+
using ldiv_t = see below; // freestanding
|
| 55 |
+
using lldiv_t = see below; // freestanding
|
| 56 |
}
|
| 57 |
|
| 58 |
#define NULL see below // freestanding
|
| 59 |
+
#define EXIT_FAILURE see below // freestanding
|
| 60 |
+
#define EXIT_SUCCESS see below // freestanding
|
| 61 |
#define RAND_MAX see below
|
| 62 |
#define MB_CUR_MAX see below
|
| 63 |
|
| 64 |
namespace std {
|
| 65 |
// Exposition-only function type aliases
|
|
|
|
| 83 |
|
| 84 |
// [c.malloc], C library memory allocation
|
| 85 |
void* aligned_alloc(size_t alignment, size_t size);
|
| 86 |
void* calloc(size_t nmemb, size_t size);
|
| 87 |
void free(void* ptr);
|
| 88 |
+
void free_sized(void* ptr, size_t size);
|
| 89 |
+
void free_aligned_sized(void* ptr, size_t alignment, size_t size);
|
| 90 |
void* malloc(size_t size);
|
| 91 |
void* realloc(void* ptr, size_t size);
|
| 92 |
+
size_t memalignment(const void* p); // freestanding
|
| 93 |
|
| 94 |
double atof(const char* nptr);
|
| 95 |
int atoi(const char* nptr);
|
| 96 |
long int atol(const char* nptr);
|
| 97 |
long long int atoll(const char* nptr);
|
| 98 |
double strtod(const char* nptr, char** endptr);
|
| 99 |
+
int strfromd(char* s, size_t n, const char* format, double fp);
|
| 100 |
+
int strfromf(char* s, size_t n, const char* format, float fp);
|
| 101 |
+
int strfroml(char* s, size_t n, const char* format, long double fp);
|
| 102 |
float strtof(const char* nptr, char** endptr);
|
| 103 |
long double strtold(const char* nptr, char** endptr);
|
| 104 |
long int strtol(const char* nptr, char** endptr, int base);
|
| 105 |
long long int strtoll(const char* nptr, char** endptr, int base);
|
| 106 |
unsigned long int strtoul(const char* nptr, char** endptr, int base);
|
|
|
|
| 112 |
int wctomb(char* s, wchar_t wchar);
|
| 113 |
size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n);
|
| 114 |
size_t wcstombs(char* s, const wchar_t* pwcs, size_t n);
|
| 115 |
|
| 116 |
// [alg.c.library], C standard library algorithms
|
| 117 |
+
void* bsearch(const void* key, void* base, size_t nmemb, size_t size, // freestanding
|
| 118 |
c-compare-pred* compar);
|
| 119 |
+
void* bsearch(const void* key, void* base, size_t nmemb, size_t size, // freestanding
|
| 120 |
compare-pred* compar);
|
| 121 |
+
const void* bsearch(const void* key, const void* base, size_t nmemb, // freestanding
|
| 122 |
+
size_t size, c-compare-pred* compar);
|
| 123 |
+
const void* bsearch(const void* key, const void* base, size_t nmemb, // freestanding
|
| 124 |
+
size_t size, compare-pred* compar);
|
| 125 |
+
void qsort(void* base, size_t nmemb, size_t size, c-compare-pred* compar); // freestanding
|
| 126 |
+
void qsort(void* base, size_t nmemb, size_t size, compare-pred* compar); // freestanding
|
| 127 |
|
| 128 |
// [c.math.rand], low-quality random number generation
|
| 129 |
int rand();
|
| 130 |
void srand(unsigned int seed);
|
| 131 |
|
| 132 |
// [c.math.abs], absolute values
|
| 133 |
+
constexpr int abs(int j); // freestanding
|
| 134 |
+
constexpr long int abs(long int j); // freestanding
|
| 135 |
+
constexpr long long int abs(long long int j); // freestanding
|
| 136 |
+
constexpr floating-point-type abs(floating-point-type j); // freestanding-deleted
|
| 137 |
|
| 138 |
+
constexpr long int labs(long int j); // freestanding
|
| 139 |
+
constexpr long long int llabs(long long int j); // freestanding
|
| 140 |
|
| 141 |
+
constexpr div_t div(int numer, int denom); // freestanding
|
| 142 |
+
constexpr ldiv_t div(long int numer, long int denom); // freestanding; see [library.c]
|
| 143 |
+
constexpr lldiv_t div(long long int numer, long long int denom); // freestanding; see [library.c]
|
| 144 |
+
constexpr ldiv_t ldiv(long int numer, long int denom); // freestanding
|
| 145 |
+
constexpr lldiv_t lldiv(long long int numer, long long int denom); // freestanding
|
| 146 |
}
|
| 147 |
```
|
| 148 |
|
| 149 |
The contents and meaning of the header `<cstdlib>` are the same as the C
|
| 150 |
standard library header `<stdlib.h>`, except that it does not declare
|
| 151 |
+
the types `wchar_t` or `once_flag`, and does not declare the function
|
| 152 |
+
`call_once`, and except as noted in [[support.types.nullptr]],
|
| 153 |
[[support.types.layout]], [[support.start.term]], [[c.malloc]],
|
| 154 |
[[c.mb.wcs]], [[alg.c.library]], [[c.math.rand]], and [[c.math.abs]].
|
| 155 |
|
| 156 |
[*Note 1*: Several functions have additional overloads in this
|
| 157 |
document, but they have the same behavior as in the C standard library
|
| 158 |
[[library.c]]. — *end note*]
|
| 159 |
|
| 160 |
+
See also: ISO C 7.24
|
| 161 |
|
| 162 |
### Null pointers <a id="support.types.nullptr">[[support.types.nullptr]]</a>
|
| 163 |
|
| 164 |
The type `nullptr_t` is a synonym for the type of a `nullptr`
|
| 165 |
expression, and it has the characteristics described in
|
|
|
|
| 170 |
taken. — *end note*]
|
| 171 |
|
| 172 |
The macro `NULL` is an *implementation-defined* null pointer
|
| 173 |
constant.[^1]
|
| 174 |
|
| 175 |
+
See also: ISO C 7.21
|
| 176 |
|
| 177 |
### Sizes, alignments, and offsets <a id="support.types.layout">[[support.types.layout]]</a>
|
| 178 |
|
| 179 |
The macro `offsetof(type, member-designator)` has the same semantics as
|
| 180 |
the corresponding macro in the C standard library header `<stddef.h>`,
|
|
|
|
| 201 |
*Recommended practice:* An implementation should choose types for
|
| 202 |
`ptrdiff_t` and `size_t` whose integer conversion ranks [[conv.rank]]
|
| 203 |
are no greater than that of `signed long int` unless a larger size is
|
| 204 |
necessary to contain all the possible values.
|
| 205 |
|
| 206 |
+
The type `max_align_t` is a trivially copyable standard-layout type
|
| 207 |
+
whose alignment requirement is at least as great as that of every scalar
|
| 208 |
+
type, and whose alignment requirement is supported in every context
|
| 209 |
+
[[basic.align]].
|
| 210 |
+
`std::is_trivially_default_constructible_v<max_align_t>` is `true`.
|
| 211 |
|
| 212 |
+
See also: ISO C 7.21
|
| 213 |
|
| 214 |
### `byte` type operations <a id="support.types.byteops">[[support.types.byteops]]</a>
|
| 215 |
|
| 216 |
``` cpp
|
| 217 |
template<class IntType>
|