- tmp/tmpm19ad_83/{from.md → to.md} +161 -149
tmp/tmpm19ad_83/{from.md → to.md}
RENAMED
|
@@ -4,13 +4,13 @@
|
|
| 4 |
|
| 5 |
This section describes the constraints upon, and latitude of,
|
| 6 |
implementations of the C++standard library.
|
| 7 |
|
| 8 |
An implementation’s use of headers is discussed in [[res.on.headers]],
|
| 9 |
-
its use of macros in [[res.on.macro.definitions]],
|
| 10 |
-
[[global.functions]], member functions in [[member.functions]],
|
| 11 |
-
race avoidance in [[res.on.data.races]], access specifiers in
|
| 12 |
[[protection.within.classes]], class derivation in [[derivation]], and
|
| 13 |
exceptions in [[res.on.exception.handling]].
|
| 14 |
|
| 15 |
#### Headers <a id="res.on.headers">[[res.on.headers]]</a>
|
| 16 |
|
|
@@ -23,12 +23,13 @@ headers.
|
|
| 23 |
Certain types and macros are defined in more than one header. Every such
|
| 24 |
entity shall be defined such that any header that defines it may be
|
| 25 |
included after any other header that also defines it (
|
| 26 |
[[basic.def.odr]]).
|
| 27 |
|
| 28 |
-
The C standard headers ([[depr.c.headers]]) shall include only
|
| 29 |
-
corresponding C++standard header, as described in
|
|
|
|
| 30 |
|
| 31 |
#### Restrictions on macro definitions <a id="res.on.macro.definitions">[[res.on.macro.definitions]]</a>
|
| 32 |
|
| 33 |
The names and global function signatures described in [[contents]] are
|
| 34 |
reserved to the implementation.
|
|
@@ -36,66 +37,71 @@ reserved to the implementation.
|
|
| 36 |
All object-like macros defined by the C standard library and described
|
| 37 |
in this Clause as expanding to integral constant expressions are also
|
| 38 |
suitable for use in `#if` preprocessing directives, unless explicitly
|
| 39 |
stated otherwise.
|
| 40 |
|
| 41 |
-
####
|
| 42 |
|
| 43 |
-
It is unspecified whether any
|
| 44 |
-
|
| 45 |
|
| 46 |
-
A call to a
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
|
| 51 |
-
An implementation shall not declare a
|
| 52 |
-
|
| 53 |
|
| 54 |
-
Unless otherwise specified,
|
| 55 |
-
|
| 56 |
-
are found through *argument-dependent name
|
| 57 |
-
[[basic.lookup.argdep]]).
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
*Effects:*
|
| 62 |
|
| 63 |
``` cpp
|
| 64 |
*out_stream << value;
|
| 65 |
if (delim != 0)
|
| 66 |
*out_stream << delim;
|
| 67 |
return *this;
|
| 68 |
```
|
| 69 |
|
|
|
|
|
|
|
| 70 |
#### Member functions <a id="member.functions">[[member.functions]]</a>
|
| 71 |
|
| 72 |
It is unspecified whether any member functions in the C++standard
|
| 73 |
-
library are defined as `inline` ([[dcl.
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
more member function signatures with equivalent behavior; and
|
| 83 |
-
- by adding a member function signature for a member function name.
|
| 84 |
|
| 85 |
-
|
| 86 |
-
library behaves as if the implementation declares no additional member
|
| 87 |
-
function signatures.[^29]
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
constructors an implementation shall provide corresponding definitions.
|
| 97 |
|
| 98 |
#### Requirements for stable algorithms <a id="algorithm.stable">[[algorithm.stable]]</a>
|
| 99 |
|
| 100 |
When the requirements for an algorithm state that it is “stable” without
|
| 101 |
further elaboration, it means:
|
|
@@ -109,12 +115,12 @@ further elaboration, it means:
|
|
| 109 |
original order) precede the elements from the second range (preserving
|
| 110 |
their original order).
|
| 111 |
|
| 112 |
#### Reentrancy <a id="reentrancy">[[reentrancy]]</a>
|
| 113 |
|
| 114 |
-
Except where explicitly specified in this
|
| 115 |
-
*implementation-defined* which functions in the
|
| 116 |
be recursively reentered.
|
| 117 |
|
| 118 |
#### Data race avoidance <a id="res.on.data.races">[[res.on.data.races]]</a>
|
| 119 |
|
| 120 |
This section specifies requirements that implementations shall meet to
|
|
@@ -131,36 +137,38 @@ via the function’s arguments, including `this`.
|
|
| 131 |
A C++standard library function shall not directly or indirectly modify
|
| 132 |
objects ([[intro.multithread]]) accessible by threads other than the
|
| 133 |
current thread unless the objects are accessed directly or indirectly
|
| 134 |
via the function’s non-const arguments, including `this`.
|
| 135 |
|
| 136 |
-
This means, for example, that implementations can’t use a
|
| 137 |
-
for internal purposes without synchronization because it
|
| 138 |
-
data race even in programs that do not explicitly share
|
| 139 |
-
threads.
|
| 140 |
|
| 141 |
A C++standard library function shall not access objects indirectly
|
| 142 |
accessible via its arguments or via elements of its container arguments
|
| 143 |
except by invoking functions required by its specification on those
|
| 144 |
container elements.
|
| 145 |
|
| 146 |
Operations on iterators obtained by calling a standard library container
|
| 147 |
or string member function may access the underlying container, but shall
|
| 148 |
-
not modify it.
|
|
|
|
|
|
|
| 149 |
iterators conflict with operations on iterators associated with that
|
| 150 |
-
container.
|
| 151 |
|
| 152 |
Implementations may share their own internal objects between threads if
|
| 153 |
the objects are not visible to users and are protected against data
|
| 154 |
races.
|
| 155 |
|
| 156 |
Unless otherwise specified, C++standard library functions shall perform
|
| 157 |
all operations solely within the current thread if those operations have
|
| 158 |
effects that are visible ([[intro.multithread]]) to users.
|
| 159 |
|
| 160 |
-
This allows implementations to parallelize operations if
|
| 161 |
-
visible side effects.
|
| 162 |
|
| 163 |
#### Protection within classes <a id="protection.within.classes">[[protection.within.classes]]</a>
|
| 164 |
|
| 165 |
It is unspecified whether any function signature or class described in
|
| 166 |
Clauses [[language.support]] through [[thread]] and Annex [[depr]] is
|
|
@@ -178,64 +186,74 @@ through a hierarchy of base classes with names reserved to the
|
|
| 178 |
implementation.
|
| 179 |
|
| 180 |
In any case:
|
| 181 |
|
| 182 |
- Every base class described as `virtual` shall be virtual;
|
| 183 |
-
- Every base class
|
| 184 |
- Unless explicitly stated otherwise, types with distinct names shall be
|
| 185 |
-
distinct types.[^
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
#### Restrictions on exception handling <a id="res.on.exception.handling">[[res.on.exception.handling]]</a>
|
| 188 |
|
| 189 |
Any of the functions defined in the C++standard library can report a
|
| 190 |
-
failure by throwing an exception of a type described in its
|
| 191 |
-
|
| 192 |
-
|
|
|
|
| 193 |
|
| 194 |
-
|
| 195 |
-
type is derived from a type named in the clause and would be caught by
|
| 196 |
-
an exception handler for the base type.
|
| 197 |
-
|
| 198 |
-
Functions from the C standard library shall not throw exceptions [^31]
|
| 199 |
except when such a function calls a program-supplied function that
|
| 200 |
-
throws an exception.[^
|
| 201 |
|
| 202 |
Destructor operations defined in the C++standard library shall not throw
|
| 203 |
exceptions. Every destructor in the C++standard library shall behave as
|
| 204 |
-
if it had a non-throwing exception specification.
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
|
| 210 |
#### Restrictions on storage of pointers <a id="res.on.pointer.storage">[[res.on.pointer.storage]]</a>
|
| 211 |
|
| 212 |
Objects constructed by the standard library that may hold a
|
| 213 |
user-supplied pointer value or an integer of type `std::intptr_t` shall
|
| 214 |
store such values in a traceable pointer location (
|
| 215 |
-
[[basic.stc.dynamic.safety]]).
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
|
|
|
|
|
|
| 220 |
|
| 221 |
#### Value of error codes <a id="value.error.codes">[[value.error.codes]]</a>
|
| 222 |
|
| 223 |
Certain functions in the C++standard library report errors via a
|
| 224 |
`std::error_code` ([[syserr.errcode.overview]]) object. That object’s
|
| 225 |
`category()` member shall return `std::system_category()` for errors
|
| 226 |
originating from the operating system, or a reference to an
|
| 227 |
*implementation-defined* `error_category` object for errors originating
|
| 228 |
elsewhere. The implementation shall define the possible values of
|
| 229 |
-
`value()` for each of these error categories.
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
|
|
|
|
|
|
| 237 |
|
| 238 |
#### Moved-from state of library types <a id="lib.types.movedfrom">[[lib.types.movedfrom]]</a>
|
| 239 |
|
| 240 |
Objects of types defined in the C++standard library may be moved from (
|
| 241 |
[[class.copy]]). Move operations may be explicitly specified or
|
|
@@ -245,18 +263,21 @@ objects shall be placed in a valid but unspecified state.
|
|
| 245 |
<!-- Link reference definitions -->
|
| 246 |
[alg.c.library]: algorithms.md#alg.c.library
|
| 247 |
[alg.sorting]: algorithms.md#alg.sorting
|
| 248 |
[algorithm.stable]: #algorithm.stable
|
| 249 |
[algorithms]: algorithms.md#algorithms
|
|
|
|
| 250 |
[alloc.errors]: language.md#alloc.errors
|
| 251 |
[allocator.requirements]: #allocator.requirements
|
|
|
|
| 252 |
[allocator.traits]: utilities.md#allocator.traits
|
| 253 |
[alt.headers]: #alt.headers
|
| 254 |
[atomics]: atomics.md#atomics
|
| 255 |
[bad.alloc]: language.md#bad.alloc
|
| 256 |
[basic.def.odr]: basic.md#basic.def.odr
|
| 257 |
[basic.fundamental]: basic.md#basic.fundamental
|
|
|
|
| 258 |
[basic.link]: basic.md#basic.link
|
| 259 |
[basic.lookup.argdep]: basic.md#basic.lookup.argdep
|
| 260 |
[basic.scope.namespace]: basic.md#basic.scope.namespace
|
| 261 |
[basic.start]: basic.md#basic.start
|
| 262 |
[basic.stc.dynamic]: basic.md#basic.stc.dynamic
|
|
@@ -265,10 +286,11 @@ objects shall be placed in a valid but unspecified state.
|
|
| 265 |
[bitmask.types]: #bitmask.types
|
| 266 |
[byte.strings]: #byte.strings
|
| 267 |
[c.locales]: localization.md#c.locales
|
| 268 |
[c.strings]: strings.md#c.strings
|
| 269 |
[character.seq]: #character.seq
|
|
|
|
| 270 |
[class.copy]: special.md#class.copy
|
| 271 |
[class.ctor]: special.md#class.ctor
|
| 272 |
[class.dtor]: special.md#class.dtor
|
| 273 |
[class.mem]: class.md#class.mem
|
| 274 |
[class.mfct]: class.md#class.mfct
|
|
@@ -289,49 +311,50 @@ objects shall be placed in a valid but unspecified state.
|
|
| 289 |
[cstdint]: language.md#cstdint
|
| 290 |
[dcl.array]: dcl.md#dcl.array
|
| 291 |
[dcl.attr]: dcl.md#dcl.attr
|
| 292 |
[dcl.constexpr]: dcl.md#dcl.constexpr
|
| 293 |
[dcl.fct.default]: dcl.md#dcl.fct.default
|
| 294 |
-
[dcl.fct.spec]: dcl.md#dcl.fct.spec
|
| 295 |
[dcl.init]: dcl.md#dcl.init
|
|
|
|
|
|
|
| 296 |
[dcl.link]: dcl.md#dcl.link
|
| 297 |
[definitions]: #definitions
|
| 298 |
-
[defns.additional]: #defns.additional
|
| 299 |
[depr]: future.md#depr
|
| 300 |
[depr.c.headers]: future.md#depr.c.headers
|
|
|
|
|
|
|
| 301 |
[derivation]: #derivation
|
| 302 |
[derived.classes]: #derived.classes
|
| 303 |
[description]: #description
|
| 304 |
-
[destructible]: #destructible
|
| 305 |
[diagnostics]: diagnostics.md#diagnostics
|
| 306 |
[enumerated.types]: #enumerated.types
|
| 307 |
-
[equalitycomparable]: #equalitycomparable
|
| 308 |
[except]: except.md#except
|
|
|
|
|
|
|
|
|
|
| 309 |
[expr.delete]: expr.md#expr.delete
|
| 310 |
[expr.eq]: expr.md#expr.eq
|
| 311 |
[expr.new]: expr.md#expr.new
|
| 312 |
[expr.rel]: expr.md#expr.rel
|
| 313 |
[extern.names]: #extern.names
|
| 314 |
[extern.types]: #extern.types
|
| 315 |
[function.objects]: utilities.md#function.objects
|
| 316 |
[functions.within.classes]: #functions.within.classes
|
| 317 |
[global.functions]: #global.functions
|
| 318 |
-
[global.names]: #global.names
|
| 319 |
[handler.functions]: #handler.functions
|
| 320 |
-
[hash]: #hash
|
| 321 |
[hash.requirements]: #hash.requirements
|
| 322 |
[headers]: #headers
|
| 323 |
[input.output]: input.md#input.output
|
| 324 |
[intro.compliance]: intro.md#intro.compliance
|
| 325 |
[intro.defs]: intro.md#intro.defs
|
| 326 |
[intro.multithread]: intro.md#intro.multithread
|
| 327 |
[intro.refs]: intro.md#intro.refs
|
| 328 |
[iterator.requirements]: iterators.md#iterator.requirements
|
|
|
|
| 329 |
[iterators]: iterators.md#iterators
|
| 330 |
[language.support]: language.md#language.support
|
| 331 |
[lex]: lex.md#lex
|
| 332 |
-
[lex.key]: lex.md#lex.key
|
| 333 |
[lex.phases]: lex.md#lex.phases
|
| 334 |
[lib.types.movedfrom]: #lib.types.movedfrom
|
| 335 |
[library]: #library
|
| 336 |
[library.c]: #library.c
|
| 337 |
[library.general]: #library.general
|
|
@@ -341,25 +364,27 @@ objects shall be placed in a valid but unspecified state.
|
|
| 341 |
[member.functions]: #member.functions
|
| 342 |
[meta]: utilities.md#meta
|
| 343 |
[multibyte.strings]: #multibyte.strings
|
| 344 |
[namespace.constraints]: #namespace.constraints
|
| 345 |
[namespace.def]: dcl.md#namespace.def
|
|
|
|
| 346 |
[namespace.posix]: #namespace.posix
|
| 347 |
[namespace.std]: #namespace.std
|
| 348 |
[namespace.udecl]: dcl.md#namespace.udecl
|
| 349 |
[new.delete]: language.md#new.delete
|
| 350 |
[new.handler]: language.md#new.handler
|
| 351 |
-
[nullablepointer]: #nullablepointer
|
| 352 |
[nullablepointer.requirements]: #nullablepointer.requirements
|
| 353 |
[numeric.requirements]: numerics.md#numeric.requirements
|
| 354 |
[numerics]: numerics.md#numerics
|
| 355 |
[objects.within.classes]: #objects.within.classes
|
| 356 |
[organization]: #organization
|
| 357 |
[ostream.iterator.ops]: iterators.md#ostream.iterator.ops
|
|
|
|
| 358 |
[over.match]: over.md#over.match
|
| 359 |
[over.oper]: over.md#over.oper
|
| 360 |
[protection.within.classes]: #protection.within.classes
|
|
|
|
| 361 |
[re]: re.md#re
|
| 362 |
[reentrancy]: #reentrancy
|
| 363 |
[replacement.functions]: #replacement.functions
|
| 364 |
[requirements]: #requirements
|
| 365 |
[res.on.arguments]: #res.on.arguments
|
|
@@ -390,164 +415,151 @@ objects shall be placed in a valid but unspecified state.
|
|
| 390 |
[support.start.term]: language.md#support.start.term
|
| 391 |
[support.types]: language.md#support.types
|
| 392 |
[swappable.requirements]: #swappable.requirements
|
| 393 |
[syserr]: diagnostics.md#syserr
|
| 394 |
[syserr.errcode.overview]: diagnostics.md#syserr.errcode.overview
|
|
|
|
|
|
|
| 395 |
[tab:cpp.c.headers]: #tab:cpp.c.headers
|
| 396 |
[tab:cpp.headers.freestanding]: #tab:cpp.headers.freestanding
|
| 397 |
[tab:cpp.library.headers]: #tab:cpp.library.headers
|
| 398 |
[tab:desc.var.def]: #tab:desc.var.def
|
|
|
|
|
|
|
|
|
|
| 399 |
[tab:identifiers.special]: lex.md#tab:identifiers.special
|
| 400 |
[tab:library.categories]: #tab:library.categories
|
|
|
|
|
|
|
| 401 |
[tab:utilities.allocator.requirements]: #tab:utilities.allocator.requirements
|
| 402 |
[temp.deduct.call]: temp.md#temp.deduct.call
|
| 403 |
[template.bitset]: utilities.md#template.bitset
|
| 404 |
[terminate.handler]: language.md#terminate.handler
|
| 405 |
[thread]: thread.md#thread
|
| 406 |
[type.descriptions]: #type.descriptions
|
| 407 |
[type.descriptions.general]: #type.descriptions.general
|
| 408 |
-
[unexpected.handler]: future.md#unexpected.handler
|
| 409 |
[using]: #using
|
| 410 |
[using.headers]: #using.headers
|
| 411 |
[using.linkage]: #using.linkage
|
| 412 |
[using.overview]: #using.overview
|
| 413 |
[usrlit.suffix]: #usrlit.suffix
|
| 414 |
[utilities]: utilities.md#utilities
|
| 415 |
[utility]: utilities.md#utility
|
| 416 |
[utility.arg.requirements]: #utility.arg.requirements
|
| 417 |
[utility.requirements]: #utility.requirements
|
| 418 |
[value.error.codes]: #value.error.codes
|
|
|
|
| 419 |
|
| 420 |
-
[^1]:
|
| 421 |
-
|
| 422 |
-
[^2]: To save space, items that do not apply to a Clause are omitted.
|
| 423 |
For example, if a Clause does not specify any requirements, there
|
| 424 |
will be no “Requirements” subclause.
|
| 425 |
|
| 426 |
-
[^
|
| 427 |
implementation.
|
| 428 |
|
| 429 |
-
[^
|
| 430 |
example, if a class does not specify any comparison functions, there
|
| 431 |
will be no “Comparison functions” subclause.
|
| 432 |
|
| 433 |
-
[^
|
| 434 |
For example, if a function does not specify any further
|
| 435 |
-
preconditions, there will be no
|
| 436 |
|
| 437 |
-
[^
|
| 438 |
some cases.
|
| 439 |
|
| 440 |
-
[^
|
| 441 |
`EqualityComparable`, `LessThanComparable`, `CopyConstructible`.
|
| 442 |
Examples from [[iterator.requirements]] include: `InputIterator`,
|
| 443 |
-
`ForwardIterator`
|
| 444 |
|
| 445 |
-
[^
|
| 446 |
[[basic.fundamental]]).
|
| 447 |
|
| 448 |
-
[^
|
| 449 |
-
7.1.1.
|
| 450 |
|
| 451 |
-
[^
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
in `<cstring>` ([[c.strings]]) are character sequences or NTBSs.
|
| 455 |
-
The size of some of these character sequences is limited by a length
|
| 456 |
value, maintained separately from the character sequence.
|
| 457 |
|
| 458 |
-
[^
|
| 459 |
|
| 460 |
-
[^
|
| 461 |
character set is also an NTMBS. Each multibyte character then
|
| 462 |
consists of a single byte.
|
| 463 |
|
| 464 |
-
[^
|
| 465 |
define names within the global namespace, while the C++headers for C
|
| 466 |
library facilities ([[headers]]) may also define names within the
|
| 467 |
global namespace.
|
| 468 |
|
| 469 |
-
[^
|
| 470 |
support multiple configurations of the library.
|
| 471 |
|
| 472 |
-
[^
|
| 473 |
delimited by `<` and `>` in header names necessarily valid source
|
| 474 |
file names ([[cpp.include]]).
|
| 475 |
|
| 476 |
-
[^
|
|
|
|
|
|
|
|
|
|
| 477 |
macro in addition to the function prototype. The only way to achieve
|
| 478 |
equivalent inline behavior in C++is to provide a definition as an
|
| 479 |
extern inline function.
|
| 480 |
|
| 481 |
-
[^
|
| 482 |
`<ciso646>` has no effect.
|
| 483 |
|
| 484 |
-
[^
|
| 485 |
namespace, whereas the newer forms keep their names in namespace
|
| 486 |
`std`. Therefore, the newer forms are the preferred forms for all
|
| 487 |
uses except for C++programs which are intended to be strictly
|
| 488 |
compatible with C.
|
| 489 |
|
| 490 |
-
[^
|
| 491 |
|
| 492 |
-
[^
|
| 493 |
-
from the
|
| 494 |
it, notwithstanding the latitude granted in 7.1.4 of the C Standard.
|
| 495 |
|
| 496 |
-
[^
|
| 497 |
be prepared to work adequately with any user-supplied specialization
|
| 498 |
-
that meets the minimum requirements of
|
| 499 |
|
| 500 |
-
[^
|
| 501 |
defined in `<cerrno>`.
|
| 502 |
|
| 503 |
-
[^
|
| 504 |
linkage includes `setjmp(jmp_buf)`, declared or defined in
|
| 505 |
`<csetjmp>`, and `va_end(va_list)`, declared or defined in
|
| 506 |
`<cstdarg>`.
|
| 507 |
|
| 508 |
-
[^
|
| 509 |
`<cwctype>` are always reserved, notwithstanding the restrictions
|
| 510 |
imposed in subclause 4.5.1 of Amendment 1 to the C Standard for
|
| 511 |
these headers.
|
| 512 |
|
| 513 |
-
[^
|
| 514 |
`ldiv_t`, `mbstate_t`, `ptrdiff_t`, `sig_atomic_t`, `size_t`,
|
| 515 |
`time_t`, `tm`, `va_list`, `wctrans_t`, `wctype_t`, and `wint_t`.
|
| 516 |
|
| 517 |
-
[^
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
a valid C++program.
|
| 521 |
|
| 522 |
-
[^
|
| 523 |
-
C++standard library has an unspecified type.
|
| 524 |
-
|
| 525 |
-
[^29]: A valid C++program always calls the expected library member
|
| 526 |
-
function, or one with equivalent behavior. An implementation may
|
| 527 |
-
also define additional member functions that would otherwise not be
|
| 528 |
-
called by a valid C++program.
|
| 529 |
-
|
| 530 |
-
[^30]: There is an implicit exception to this rule for types that are
|
| 531 |
described as synonyms for basic integral types, such as `size_t` (
|
| 532 |
[[support.types]]) and `streamoff` ([[stream.types]]).
|
| 533 |
|
| 534 |
-
[^
|
| 535 |
are marked `noexcept`. This allows implementations to make
|
| 536 |
performance optimizations based on the absence of exceptions at
|
| 537 |
runtime.
|
| 538 |
|
| 539 |
-
[^
|
| 540 |
this condition.
|
| 541 |
|
| 542 |
-
[^
|
| 543 |
throwing an exception of type `bad_alloc`, or a class derived from
|
| 544 |
-
`bad_alloc` ([[bad.alloc]]).
|
| 545 |
-
errors by throwing exceptions of or derived from the standard
|
| 546 |
-
exception classes ([[bad.alloc]], [[support.exception]],
|
| 547 |
-
[[std.exceptions]]).
|
| 548 |
-
|
| 549 |
-
[^34]: That is, an implementation may provide an explicit
|
| 550 |
-
*exception-specification* that defines the subset of “any”
|
| 551 |
-
exceptions thrown by that function. This implies that the
|
| 552 |
-
implementation may list implementation-defined types in such an
|
| 553 |
-
*exception-specification*.
|
|
|
|
| 4 |
|
| 5 |
This section describes the constraints upon, and latitude of,
|
| 6 |
implementations of the C++standard library.
|
| 7 |
|
| 8 |
An implementation’s use of headers is discussed in [[res.on.headers]],
|
| 9 |
+
its use of macros in [[res.on.macro.definitions]], non-member functions
|
| 10 |
+
in [[global.functions]], member functions in [[member.functions]],
|
| 11 |
+
data race avoidance in [[res.on.data.races]], access specifiers in
|
| 12 |
[[protection.within.classes]], class derivation in [[derivation]], and
|
| 13 |
exceptions in [[res.on.exception.handling]].
|
| 14 |
|
| 15 |
#### Headers <a id="res.on.headers">[[res.on.headers]]</a>
|
| 16 |
|
|
|
|
| 23 |
Certain types and macros are defined in more than one header. Every such
|
| 24 |
entity shall be defined such that any header that defines it may be
|
| 25 |
included after any other header that also defines it (
|
| 26 |
[[basic.def.odr]]).
|
| 27 |
|
| 28 |
+
The C standard library headers ([[depr.c.headers]]) shall include only
|
| 29 |
+
their corresponding C++standard library header, as described in
|
| 30 |
+
[[headers]].
|
| 31 |
|
| 32 |
#### Restrictions on macro definitions <a id="res.on.macro.definitions">[[res.on.macro.definitions]]</a>
|
| 33 |
|
| 34 |
The names and global function signatures described in [[contents]] are
|
| 35 |
reserved to the implementation.
|
|
|
|
| 37 |
All object-like macros defined by the C standard library and described
|
| 38 |
in this Clause as expanding to integral constant expressions are also
|
| 39 |
suitable for use in `#if` preprocessing directives, unless explicitly
|
| 40 |
stated otherwise.
|
| 41 |
|
| 42 |
+
#### Non-member functions <a id="global.functions">[[global.functions]]</a>
|
| 43 |
|
| 44 |
+
It is unspecified whether any non-member functions in the C++standard
|
| 45 |
+
library are defined as `inline` ([[dcl.inline]]).
|
| 46 |
|
| 47 |
+
A call to a non-member function signature described in Clauses
|
| 48 |
+
[[language.support]] through [[thread]] and Annex [[depr]] shall
|
| 49 |
+
behave as if the implementation declared no additional non-member
|
| 50 |
+
function signatures.[^26]
|
| 51 |
|
| 52 |
+
An implementation shall not declare a non-member function signature with
|
| 53 |
+
additional default arguments.
|
| 54 |
|
| 55 |
+
Unless otherwise specified, calls made by functions in the standard
|
| 56 |
+
library to non-operator, non-member functions do not use functions from
|
| 57 |
+
another namespace which are found through *argument-dependent name
|
| 58 |
+
lookup* ([[basic.lookup.argdep]]).
|
| 59 |
+
|
| 60 |
+
[*Note 1*:
|
| 61 |
+
|
| 62 |
+
The phrase “unless otherwise specified” applies to cases such as the
|
| 63 |
+
swappable with requirements ([[swappable.requirements]]). The exception
|
| 64 |
+
for overloaded operators allows argument-dependent lookup in cases like
|
| 65 |
+
that of `ostream_iterator::operator=` ([[ostream.iterator.ops]]):
|
| 66 |
|
| 67 |
*Effects:*
|
| 68 |
|
| 69 |
``` cpp
|
| 70 |
*out_stream << value;
|
| 71 |
if (delim != 0)
|
| 72 |
*out_stream << delim;
|
| 73 |
return *this;
|
| 74 |
```
|
| 75 |
|
| 76 |
+
— *end note*]
|
| 77 |
+
|
| 78 |
#### Member functions <a id="member.functions">[[member.functions]]</a>
|
| 79 |
|
| 80 |
It is unspecified whether any member functions in the C++standard
|
| 81 |
+
library are defined as `inline` ([[dcl.inline]]).
|
| 82 |
|
| 83 |
+
For a non-virtual member function described in the C++standard library,
|
| 84 |
+
an implementation may declare a different set of member function
|
| 85 |
+
signatures, provided that any call to the member function that would
|
| 86 |
+
select an overload from the set of declarations described in this
|
| 87 |
+
International Standard behaves as if that overload were selected.
|
| 88 |
|
| 89 |
+
[*Note 1*: For instance, an implementation may add parameters with
|
| 90 |
+
default values, or replace a member function with default arguments with
|
| 91 |
+
two or more member functions with equivalent behavior, or add additional
|
| 92 |
+
signatures for a member function name. — *end note*]
|
|
|
|
|
|
|
| 93 |
|
| 94 |
+
#### Constexpr functions and constructors <a id="constexpr.functions">[[constexpr.functions]]</a>
|
|
|
|
|
|
|
| 95 |
|
| 96 |
+
This International Standard explicitly requires that certain standard
|
| 97 |
+
library functions are `constexpr` ([[dcl.constexpr]]). An
|
| 98 |
+
implementation shall not declare any standard library function signature
|
| 99 |
+
as `constexpr` except for those where it is explicitly required. Within
|
| 100 |
+
any header that provides any non-defining declarations of constexpr
|
| 101 |
+
functions or constructors an implementation shall provide corresponding
|
| 102 |
+
definitions.
|
|
|
|
| 103 |
|
| 104 |
#### Requirements for stable algorithms <a id="algorithm.stable">[[algorithm.stable]]</a>
|
| 105 |
|
| 106 |
When the requirements for an algorithm state that it is “stable” without
|
| 107 |
further elaboration, it means:
|
|
|
|
| 115 |
original order) precede the elements from the second range (preserving
|
| 116 |
their original order).
|
| 117 |
|
| 118 |
#### Reentrancy <a id="reentrancy">[[reentrancy]]</a>
|
| 119 |
|
| 120 |
+
Except where explicitly specified in this International Standard, it is
|
| 121 |
+
*implementation-defined* which functions in the C++standard library may
|
| 122 |
be recursively reentered.
|
| 123 |
|
| 124 |
#### Data race avoidance <a id="res.on.data.races">[[res.on.data.races]]</a>
|
| 125 |
|
| 126 |
This section specifies requirements that implementations shall meet to
|
|
|
|
| 137 |
A C++standard library function shall not directly or indirectly modify
|
| 138 |
objects ([[intro.multithread]]) accessible by threads other than the
|
| 139 |
current thread unless the objects are accessed directly or indirectly
|
| 140 |
via the function’s non-const arguments, including `this`.
|
| 141 |
|
| 142 |
+
[*Note 1*: This means, for example, that implementations can’t use a
|
| 143 |
+
static object for internal purposes without synchronization because it
|
| 144 |
+
could cause a data race even in programs that do not explicitly share
|
| 145 |
+
objects between threads. — *end note*]
|
| 146 |
|
| 147 |
A C++standard library function shall not access objects indirectly
|
| 148 |
accessible via its arguments or via elements of its container arguments
|
| 149 |
except by invoking functions required by its specification on those
|
| 150 |
container elements.
|
| 151 |
|
| 152 |
Operations on iterators obtained by calling a standard library container
|
| 153 |
or string member function may access the underlying container, but shall
|
| 154 |
+
not modify it.
|
| 155 |
+
|
| 156 |
+
[*Note 2*: In particular, container operations that invalidate
|
| 157 |
iterators conflict with operations on iterators associated with that
|
| 158 |
+
container. — *end note*]
|
| 159 |
|
| 160 |
Implementations may share their own internal objects between threads if
|
| 161 |
the objects are not visible to users and are protected against data
|
| 162 |
races.
|
| 163 |
|
| 164 |
Unless otherwise specified, C++standard library functions shall perform
|
| 165 |
all operations solely within the current thread if those operations have
|
| 166 |
effects that are visible ([[intro.multithread]]) to users.
|
| 167 |
|
| 168 |
+
[*Note 3*: This allows implementations to parallelize operations if
|
| 169 |
+
there are no visible side effects. — *end note*]
|
| 170 |
|
| 171 |
#### Protection within classes <a id="protection.within.classes">[[protection.within.classes]]</a>
|
| 172 |
|
| 173 |
It is unspecified whether any function signature or class described in
|
| 174 |
Clauses [[language.support]] through [[thread]] and Annex [[depr]] is
|
|
|
|
| 186 |
implementation.
|
| 187 |
|
| 188 |
In any case:
|
| 189 |
|
| 190 |
- Every base class described as `virtual` shall be virtual;
|
| 191 |
+
- Every base class not specified as `virtual` shall not be virtual;
|
| 192 |
- Unless explicitly stated otherwise, types with distinct names shall be
|
| 193 |
+
distinct types.[^27]
|
| 194 |
+
|
| 195 |
+
All types specified in the C++standard library shall be non-`final`
|
| 196 |
+
types unless otherwise specified.
|
| 197 |
|
| 198 |
#### Restrictions on exception handling <a id="res.on.exception.handling">[[res.on.exception.handling]]</a>
|
| 199 |
|
| 200 |
Any of the functions defined in the C++standard library can report a
|
| 201 |
+
failure by throwing an exception of a type described in its *Throws:*
|
| 202 |
+
paragraph, or of a type derived from a type named in the *Throws:*
|
| 203 |
+
paragraph that would be caught by an exception handler for the base
|
| 204 |
+
type.
|
| 205 |
|
| 206 |
+
Functions from the C standard library shall not throw exceptions [^28]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
except when such a function calls a program-supplied function that
|
| 208 |
+
throws an exception.[^29]
|
| 209 |
|
| 210 |
Destructor operations defined in the C++standard library shall not throw
|
| 211 |
exceptions. Every destructor in the C++standard library shall behave as
|
| 212 |
+
if it had a non-throwing exception specification.
|
| 213 |
+
|
| 214 |
+
Functions defined in the C++standard library that do not have a
|
| 215 |
+
*Throws:* paragraph but do have a potentially-throwing exception
|
| 216 |
+
specification may throw *implementation-defined* exceptions. [^30]
|
| 217 |
+
Implementations should report errors by throwing exceptions of or
|
| 218 |
+
derived from the standard exception classes ([[bad.alloc]],
|
| 219 |
+
[[support.exception]], [[std.exceptions]]).
|
| 220 |
+
|
| 221 |
+
An implementation may strengthen the exception specification for a
|
| 222 |
+
non-virtual function by adding a non-throwing exception specification.
|
| 223 |
|
| 224 |
#### Restrictions on storage of pointers <a id="res.on.pointer.storage">[[res.on.pointer.storage]]</a>
|
| 225 |
|
| 226 |
Objects constructed by the standard library that may hold a
|
| 227 |
user-supplied pointer value or an integer of type `std::intptr_t` shall
|
| 228 |
store such values in a traceable pointer location (
|
| 229 |
+
[[basic.stc.dynamic.safety]]).
|
| 230 |
+
|
| 231 |
+
[*Note 1*: Other libraries are strongly encouraged to do the same,
|
| 232 |
+
since not doing so may result in accidental use of pointers that are not
|
| 233 |
+
safely derived. Libraries that store pointers outside the user’s address
|
| 234 |
+
space should make it appear that they are stored and retrieved from a
|
| 235 |
+
traceable pointer location. — *end note*]
|
| 236 |
|
| 237 |
#### Value of error codes <a id="value.error.codes">[[value.error.codes]]</a>
|
| 238 |
|
| 239 |
Certain functions in the C++standard library report errors via a
|
| 240 |
`std::error_code` ([[syserr.errcode.overview]]) object. That object’s
|
| 241 |
`category()` member shall return `std::system_category()` for errors
|
| 242 |
originating from the operating system, or a reference to an
|
| 243 |
*implementation-defined* `error_category` object for errors originating
|
| 244 |
elsewhere. The implementation shall define the possible values of
|
| 245 |
+
`value()` for each of these error categories.
|
| 246 |
+
|
| 247 |
+
[*Example 1*: For operating systems that are based on POSIX,
|
| 248 |
+
implementations are encouraged to define the `std::system_category()`
|
| 249 |
+
values as identical to the POSIX `errno` values, with additional values
|
| 250 |
+
as defined by the operating system’s documentation. Implementations for
|
| 251 |
+
operating systems that are not based on POSIX are encouraged to define
|
| 252 |
+
values identical to the operating system’s values. For errors that do
|
| 253 |
+
not originate from the operating system, the implementation may provide
|
| 254 |
+
enums for the associated values. — *end example*]
|
| 255 |
|
| 256 |
#### Moved-from state of library types <a id="lib.types.movedfrom">[[lib.types.movedfrom]]</a>
|
| 257 |
|
| 258 |
Objects of types defined in the C++standard library may be moved from (
|
| 259 |
[[class.copy]]). Move operations may be explicitly specified or
|
|
|
|
| 263 |
<!-- Link reference definitions -->
|
| 264 |
[alg.c.library]: algorithms.md#alg.c.library
|
| 265 |
[alg.sorting]: algorithms.md#alg.sorting
|
| 266 |
[algorithm.stable]: #algorithm.stable
|
| 267 |
[algorithms]: algorithms.md#algorithms
|
| 268 |
+
[algorithms.requirements]: algorithms.md#algorithms.requirements
|
| 269 |
[alloc.errors]: language.md#alloc.errors
|
| 270 |
[allocator.requirements]: #allocator.requirements
|
| 271 |
+
[allocator.requirements.completeness]: #allocator.requirements.completeness
|
| 272 |
[allocator.traits]: utilities.md#allocator.traits
|
| 273 |
[alt.headers]: #alt.headers
|
| 274 |
[atomics]: atomics.md#atomics
|
| 275 |
[bad.alloc]: language.md#bad.alloc
|
| 276 |
[basic.def.odr]: basic.md#basic.def.odr
|
| 277 |
[basic.fundamental]: basic.md#basic.fundamental
|
| 278 |
+
[basic.life]: basic.md#basic.life
|
| 279 |
[basic.link]: basic.md#basic.link
|
| 280 |
[basic.lookup.argdep]: basic.md#basic.lookup.argdep
|
| 281 |
[basic.scope.namespace]: basic.md#basic.scope.namespace
|
| 282 |
[basic.start]: basic.md#basic.start
|
| 283 |
[basic.stc.dynamic]: basic.md#basic.stc.dynamic
|
|
|
|
| 286 |
[bitmask.types]: #bitmask.types
|
| 287 |
[byte.strings]: #byte.strings
|
| 288 |
[c.locales]: localization.md#c.locales
|
| 289 |
[c.strings]: strings.md#c.strings
|
| 290 |
[character.seq]: #character.seq
|
| 291 |
+
[class.conv.ctor]: special.md#class.conv.ctor
|
| 292 |
[class.copy]: special.md#class.copy
|
| 293 |
[class.ctor]: special.md#class.ctor
|
| 294 |
[class.dtor]: special.md#class.dtor
|
| 295 |
[class.mem]: class.md#class.mem
|
| 296 |
[class.mfct]: class.md#class.mfct
|
|
|
|
| 311 |
[cstdint]: language.md#cstdint
|
| 312 |
[dcl.array]: dcl.md#dcl.array
|
| 313 |
[dcl.attr]: dcl.md#dcl.attr
|
| 314 |
[dcl.constexpr]: dcl.md#dcl.constexpr
|
| 315 |
[dcl.fct.default]: dcl.md#dcl.fct.default
|
|
|
|
| 316 |
[dcl.init]: dcl.md#dcl.init
|
| 317 |
+
[dcl.init.list]: dcl.md#dcl.init.list
|
| 318 |
+
[dcl.inline]: dcl.md#dcl.inline
|
| 319 |
[dcl.link]: dcl.md#dcl.link
|
| 320 |
[definitions]: #definitions
|
|
|
|
| 321 |
[depr]: future.md#depr
|
| 322 |
[depr.c.headers]: future.md#depr.c.headers
|
| 323 |
+
[depr.cstdalign.syn]: future.md#depr.cstdalign.syn
|
| 324 |
+
[depr.cstdbool.syn]: future.md#depr.cstdbool.syn
|
| 325 |
[derivation]: #derivation
|
| 326 |
[derived.classes]: #derived.classes
|
| 327 |
[description]: #description
|
|
|
|
| 328 |
[diagnostics]: diagnostics.md#diagnostics
|
| 329 |
[enumerated.types]: #enumerated.types
|
|
|
|
| 330 |
[except]: except.md#except
|
| 331 |
+
[expos.only.types]: #expos.only.types
|
| 332 |
+
[expr.cond]: expr.md#expr.cond
|
| 333 |
+
[expr.const]: expr.md#expr.const
|
| 334 |
[expr.delete]: expr.md#expr.delete
|
| 335 |
[expr.eq]: expr.md#expr.eq
|
| 336 |
[expr.new]: expr.md#expr.new
|
| 337 |
[expr.rel]: expr.md#expr.rel
|
| 338 |
[extern.names]: #extern.names
|
| 339 |
[extern.types]: #extern.types
|
| 340 |
[function.objects]: utilities.md#function.objects
|
| 341 |
[functions.within.classes]: #functions.within.classes
|
| 342 |
[global.functions]: #global.functions
|
|
|
|
| 343 |
[handler.functions]: #handler.functions
|
|
|
|
| 344 |
[hash.requirements]: #hash.requirements
|
| 345 |
[headers]: #headers
|
| 346 |
[input.output]: input.md#input.output
|
| 347 |
[intro.compliance]: intro.md#intro.compliance
|
| 348 |
[intro.defs]: intro.md#intro.defs
|
| 349 |
[intro.multithread]: intro.md#intro.multithread
|
| 350 |
[intro.refs]: intro.md#intro.refs
|
| 351 |
[iterator.requirements]: iterators.md#iterator.requirements
|
| 352 |
+
[iterator.requirements.general]: iterators.md#iterator.requirements.general
|
| 353 |
[iterators]: iterators.md#iterators
|
| 354 |
[language.support]: language.md#language.support
|
| 355 |
[lex]: lex.md#lex
|
|
|
|
| 356 |
[lex.phases]: lex.md#lex.phases
|
| 357 |
[lib.types.movedfrom]: #lib.types.movedfrom
|
| 358 |
[library]: #library
|
| 359 |
[library.c]: #library.c
|
| 360 |
[library.general]: #library.general
|
|
|
|
| 364 |
[member.functions]: #member.functions
|
| 365 |
[meta]: utilities.md#meta
|
| 366 |
[multibyte.strings]: #multibyte.strings
|
| 367 |
[namespace.constraints]: #namespace.constraints
|
| 368 |
[namespace.def]: dcl.md#namespace.def
|
| 369 |
+
[namespace.future]: #namespace.future
|
| 370 |
[namespace.posix]: #namespace.posix
|
| 371 |
[namespace.std]: #namespace.std
|
| 372 |
[namespace.udecl]: dcl.md#namespace.udecl
|
| 373 |
[new.delete]: language.md#new.delete
|
| 374 |
[new.handler]: language.md#new.handler
|
|
|
|
| 375 |
[nullablepointer.requirements]: #nullablepointer.requirements
|
| 376 |
[numeric.requirements]: numerics.md#numeric.requirements
|
| 377 |
[numerics]: numerics.md#numerics
|
| 378 |
[objects.within.classes]: #objects.within.classes
|
| 379 |
[organization]: #organization
|
| 380 |
[ostream.iterator.ops]: iterators.md#ostream.iterator.ops
|
| 381 |
+
[over.literal]: over.md#over.literal
|
| 382 |
[over.match]: over.md#over.match
|
| 383 |
[over.oper]: over.md#over.oper
|
| 384 |
[protection.within.classes]: #protection.within.classes
|
| 385 |
+
[random.access.iterators]: iterators.md#random.access.iterators
|
| 386 |
[re]: re.md#re
|
| 387 |
[reentrancy]: #reentrancy
|
| 388 |
[replacement.functions]: #replacement.functions
|
| 389 |
[requirements]: #requirements
|
| 390 |
[res.on.arguments]: #res.on.arguments
|
|
|
|
| 415 |
[support.start.term]: language.md#support.start.term
|
| 416 |
[support.types]: language.md#support.types
|
| 417 |
[swappable.requirements]: #swappable.requirements
|
| 418 |
[syserr]: diagnostics.md#syserr
|
| 419 |
[syserr.errcode.overview]: diagnostics.md#syserr.errcode.overview
|
| 420 |
+
[tab:c.annex.k.names]: #tab:c.annex.k.names
|
| 421 |
+
[tab:copyassignable]: #tab:copyassignable
|
| 422 |
[tab:cpp.c.headers]: #tab:cpp.c.headers
|
| 423 |
[tab:cpp.headers.freestanding]: #tab:cpp.headers.freestanding
|
| 424 |
[tab:cpp.library.headers]: #tab:cpp.library.headers
|
| 425 |
[tab:desc.var.def]: #tab:desc.var.def
|
| 426 |
+
[tab:destructible]: #tab:destructible
|
| 427 |
+
[tab:equalitycomparable]: #tab:equalitycomparable
|
| 428 |
+
[tab:hash]: #tab:hash
|
| 429 |
[tab:identifiers.special]: lex.md#tab:identifiers.special
|
| 430 |
[tab:library.categories]: #tab:library.categories
|
| 431 |
+
[tab:moveassignable]: #tab:moveassignable
|
| 432 |
+
[tab:nullablepointer]: #tab:nullablepointer
|
| 433 |
[tab:utilities.allocator.requirements]: #tab:utilities.allocator.requirements
|
| 434 |
[temp.deduct.call]: temp.md#temp.deduct.call
|
| 435 |
[template.bitset]: utilities.md#template.bitset
|
| 436 |
[terminate.handler]: language.md#terminate.handler
|
| 437 |
[thread]: thread.md#thread
|
| 438 |
[type.descriptions]: #type.descriptions
|
| 439 |
[type.descriptions.general]: #type.descriptions.general
|
|
|
|
| 440 |
[using]: #using
|
| 441 |
[using.headers]: #using.headers
|
| 442 |
[using.linkage]: #using.linkage
|
| 443 |
[using.overview]: #using.overview
|
| 444 |
[usrlit.suffix]: #usrlit.suffix
|
| 445 |
[utilities]: utilities.md#utilities
|
| 446 |
[utility]: utilities.md#utility
|
| 447 |
[utility.arg.requirements]: #utility.arg.requirements
|
| 448 |
[utility.requirements]: #utility.requirements
|
| 449 |
[value.error.codes]: #value.error.codes
|
| 450 |
+
[zombie.names]: #zombie.names
|
| 451 |
|
| 452 |
+
[^1]: To save space, items that do not apply to a Clause are omitted.
|
|
|
|
|
|
|
| 453 |
For example, if a Clause does not specify any requirements, there
|
| 454 |
will be no “Requirements” subclause.
|
| 455 |
|
| 456 |
+
[^2]: Although in some cases the code given is unambiguously the optimum
|
| 457 |
implementation.
|
| 458 |
|
| 459 |
+
[^3]: To save space, items that do not apply to a class are omitted. For
|
| 460 |
example, if a class does not specify any comparison functions, there
|
| 461 |
will be no “Comparison functions” subclause.
|
| 462 |
|
| 463 |
+
[^4]: To save space, items that do not apply to a function are omitted.
|
| 464 |
For example, if a function does not specify any further
|
| 465 |
+
preconditions, there will be no *Requires:* paragraph.
|
| 466 |
|
| 467 |
+
[^5]: This simplifies the presentation of complexity requirements in
|
| 468 |
some cases.
|
| 469 |
|
| 470 |
+
[^6]: Examples from [[utility.requirements]] include:
|
| 471 |
`EqualityComparable`, `LessThanComparable`, `CopyConstructible`.
|
| 472 |
Examples from [[iterator.requirements]] include: `InputIterator`,
|
| 473 |
+
`ForwardIterator`.
|
| 474 |
|
| 475 |
+
[^7]: Such as an integer type, with constant integer values (
|
| 476 |
[[basic.fundamental]]).
|
| 477 |
|
| 478 |
+
[^8]: declared in `<clocale>` ([[c.locales]]).
|
|
|
|
| 479 |
|
| 480 |
+
[^9]: Many of the objects manipulated by function signatures declared in
|
| 481 |
+
`<cstring>` ([[c.strings]]) are character sequences or NTBSs. The
|
| 482 |
+
size of some of these character sequences is limited by a length
|
|
|
|
|
|
|
| 483 |
value, maintained separately from the character sequence.
|
| 484 |
|
| 485 |
+
[^10]: A string literal, such as `"abc"`, is a static NTBS.
|
| 486 |
|
| 487 |
+
[^11]: An NTBSthat contains characters only from the basic execution
|
| 488 |
character set is also an NTMBS. Each multibyte character then
|
| 489 |
consists of a single byte.
|
| 490 |
|
| 491 |
+
[^12]: The C standard library headers (Annex [[depr.c.headers]]) also
|
| 492 |
define names within the global namespace, while the C++headers for C
|
| 493 |
library facilities ([[headers]]) may also define names within the
|
| 494 |
global namespace.
|
| 495 |
|
| 496 |
+
[^13]: This gives implementers freedom to use inline namespaces to
|
| 497 |
support multiple configurations of the library.
|
| 498 |
|
| 499 |
+
[^14]: A header is not necessarily a source file, nor are the sequences
|
| 500 |
delimited by `<` and `>` in header names necessarily valid source
|
| 501 |
file names ([[cpp.include]]).
|
| 502 |
|
| 503 |
+
[^15]: It is intentional that there is no C++header for any of these C
|
| 504 |
+
headers: `<stdatomic.h>`, `<stdnoreturn.h>`, `<threads.h>`.
|
| 505 |
+
|
| 506 |
+
[^16]: This disallows the practice, allowed in C, of providing a masking
|
| 507 |
macro in addition to the function prototype. The only way to achieve
|
| 508 |
equivalent inline behavior in C++is to provide a definition as an
|
| 509 |
extern inline function.
|
| 510 |
|
| 511 |
+
[^17]: In particular, including the standard header `<iso646.h>` or
|
| 512 |
`<ciso646>` has no effect.
|
| 513 |
|
| 514 |
+
[^18]: The `".h"` headers dump all their names into the global
|
| 515 |
namespace, whereas the newer forms keep their names in namespace
|
| 516 |
`std`. Therefore, the newer forms are the preferred forms for all
|
| 517 |
uses except for C++programs which are intended to be strictly
|
| 518 |
compatible with C.
|
| 519 |
|
| 520 |
+
[^19]: This is the same as the C standard library.
|
| 521 |
|
| 522 |
+
[^20]: The only reliable way to declare an object or function signature
|
| 523 |
+
from the C standard library is by including the header that declares
|
| 524 |
it, notwithstanding the latitude granted in 7.1.4 of the C Standard.
|
| 525 |
|
| 526 |
+
[^21]: Any library code that instantiates other library templates must
|
| 527 |
be prepared to work adequately with any user-supplied specialization
|
| 528 |
+
that meets the minimum requirements of this International Standard.
|
| 529 |
|
| 530 |
+
[^22]: The list of such reserved names includes `errno`, declared or
|
| 531 |
defined in `<cerrno>`.
|
| 532 |
|
| 533 |
+
[^23]: The list of such reserved function signatures with external
|
| 534 |
linkage includes `setjmp(jmp_buf)`, declared or defined in
|
| 535 |
`<csetjmp>`, and `va_end(va_list)`, declared or defined in
|
| 536 |
`<cstdarg>`.
|
| 537 |
|
| 538 |
+
[^24]: The function signatures declared in `<cuchar>`, `<cwchar>`, and
|
| 539 |
`<cwctype>` are always reserved, notwithstanding the restrictions
|
| 540 |
imposed in subclause 4.5.1 of Amendment 1 to the C Standard for
|
| 541 |
these headers.
|
| 542 |
|
| 543 |
+
[^25]: These types are `clock_t`, `div_t`, `FILE`, `fpos_t`, `lconv`,
|
| 544 |
`ldiv_t`, `mbstate_t`, `ptrdiff_t`, `sig_atomic_t`, `size_t`,
|
| 545 |
`time_t`, `tm`, `va_list`, `wctrans_t`, `wctype_t`, and `wint_t`.
|
| 546 |
|
| 547 |
+
[^26]: A valid C++program always calls the expected library non-member
|
| 548 |
+
function. An implementation may also define additional non-member
|
| 549 |
+
functions that would otherwise not be called by a valid C++program.
|
|
|
|
| 550 |
|
| 551 |
+
[^27]: There is an implicit exception to this rule for types that are
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 552 |
described as synonyms for basic integral types, such as `size_t` (
|
| 553 |
[[support.types]]) and `streamoff` ([[stream.types]]).
|
| 554 |
|
| 555 |
+
[^28]: That is, the C library functions can all be treated as if they
|
| 556 |
are marked `noexcept`. This allows implementations to make
|
| 557 |
performance optimizations based on the absence of exceptions at
|
| 558 |
runtime.
|
| 559 |
|
| 560 |
+
[^29]: The functions `qsort()` and `bsearch()` ([[alg.c.library]]) meet
|
| 561 |
this condition.
|
| 562 |
|
| 563 |
+
[^30]: In particular, they can report a failure to allocate storage by
|
| 564 |
throwing an exception of type `bad_alloc`, or a class derived from
|
| 565 |
+
`bad_alloc` ([[bad.alloc]]).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|