- tmp/tmpc81a5sj0/{from.md → to.md} +17 -377
tmp/tmpc81a5sj0/{from.md → to.md}
RENAMED
|
@@ -28,24 +28,24 @@ function parameter is called `argv`, where `argc` shall be the number of
|
|
| 28 |
arguments passed to the program from the environment in which the
|
| 29 |
program is run. If `argc` is nonzero these arguments shall be supplied
|
| 30 |
in `argv[0]` through `argv[argc - 1]` as pointers to the initial
|
| 31 |
characters of null-terminated multibyte strings (NTMBSs)
|
| 32 |
[[multibyte.strings]] and `argv[0]` shall be the pointer to the initial
|
| 33 |
-
character of
|
| 34 |
-
or `""`. The value of `argc` shall be non-negative. The value of
|
| 35 |
`argv[argc]` shall be 0.
|
| 36 |
|
| 37 |
*Recommended practice:* Any further (optional) parameters should be
|
| 38 |
added after `argv`.
|
| 39 |
|
| 40 |
-
The function `main` shall not be
|
| 41 |
[[basic.link]] of `main` is *implementation-defined*. A program that
|
| 42 |
defines `main` as deleted or that declares `main` to be `inline`,
|
| 43 |
`static`, `constexpr`, or `consteval` is ill-formed. The function `main`
|
| 44 |
shall not be a coroutine [[dcl.fct.def.coroutine]]. The `main` function
|
| 45 |
-
shall not be declared with a *linkage-specification* [[dcl.link]]
|
| 46 |
-
program that declares
|
| 47 |
|
| 48 |
- a variable `main` that belongs to the global scope, or
|
| 49 |
- a function `main` that belongs to the global scope and is attached to
|
| 50 |
a named module, or
|
| 51 |
- a function template `main` that belongs to the global scope, or
|
|
@@ -61,29 +61,29 @@ calling the function `std::exit(int)` [[support.start.term]]) does not
|
|
| 61 |
destroy any objects with automatic storage duration [[class.dtor]]. If
|
| 62 |
`std::exit` is invoked during the destruction of an object with static
|
| 63 |
or thread storage duration, the program has undefined behavior.
|
| 64 |
|
| 65 |
A `return` statement [[stmt.return]] in `main` has the effect of leaving
|
| 66 |
-
the main function (destroying any objects with automatic storage
|
| 67 |
-
duration
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
[[except.handle]]).
|
| 71 |
|
| 72 |
#### Static initialization <a id="basic.start.static">[[basic.start.static]]</a>
|
| 73 |
|
| 74 |
Variables with static storage duration are initialized as a consequence
|
| 75 |
of program initiation. Variables with thread storage duration are
|
| 76 |
initialized as a consequence of thread execution. Within each of these
|
| 77 |
phases of initiation, initialization occurs as follows.
|
| 78 |
|
| 79 |
-
*Constant initialization* is performed if a variable
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
*static initialization*; all other initialization is
|
| 86 |
*dynamic initialization*. All static initialization strongly happens
|
| 87 |
before [[intro.races]] any dynamic initialization.
|
| 88 |
|
| 89 |
[*Note 1*: The dynamic initialization of non-block variables is
|
|
@@ -176,11 +176,11 @@ thread storage duration variable.
|
|
| 176 |
It is *implementation-defined* whether the dynamic initialization of a
|
| 177 |
non-block non-inline variable with static storage duration is sequenced
|
| 178 |
before the first statement of `main` or is deferred. If it is deferred,
|
| 179 |
it strongly happens before any non-initialization odr-use of any
|
| 180 |
non-inline function or non-inline variable defined in the same
|
| 181 |
-
translation unit as the variable to be initialized.[^
|
| 182 |
|
| 183 |
It is *implementation-defined* in which threads and at which points in
|
| 184 |
the program such deferred dynamic initialization occurs.
|
| 185 |
|
| 186 |
*Recommended practice:* An implementation should choose such points in a
|
|
@@ -316,365 +316,5 @@ static-storage-duration objects. — *end note*]
|
|
| 316 |
|
| 317 |
Calling the function `std::abort()` declared in `<cstdlib>` terminates
|
| 318 |
the program without executing any destructors and without calling the
|
| 319 |
functions passed to `std::atexit()` or `std::at_quick_exit()`.
|
| 320 |
|
| 321 |
-
<!-- Link reference definitions -->
|
| 322 |
-
[allocator.members]: mem.md#allocator.members
|
| 323 |
-
[allocator.traits.members]: mem.md#allocator.traits.members
|
| 324 |
-
[atomics]: thread.md#atomics
|
| 325 |
-
[atomics.flag]: thread.md#atomics.flag
|
| 326 |
-
[atomics.lockfree]: thread.md#atomics.lockfree
|
| 327 |
-
[atomics.order]: thread.md#atomics.order
|
| 328 |
-
[bad.alloc]: support.md#bad.alloc
|
| 329 |
-
[basic]: #basic
|
| 330 |
-
[basic.align]: #basic.align
|
| 331 |
-
[basic.compound]: #basic.compound
|
| 332 |
-
[basic.def]: #basic.def
|
| 333 |
-
[basic.def.odr]: #basic.def.odr
|
| 334 |
-
[basic.exec]: #basic.exec
|
| 335 |
-
[basic.extended.fp]: #basic.extended.fp
|
| 336 |
-
[basic.fundamental]: #basic.fundamental
|
| 337 |
-
[basic.fundamental.width]: #basic.fundamental.width
|
| 338 |
-
[basic.indet]: #basic.indet
|
| 339 |
-
[basic.life]: #basic.life
|
| 340 |
-
[basic.link]: #basic.link
|
| 341 |
-
[basic.lookup]: #basic.lookup
|
| 342 |
-
[basic.lookup.argdep]: #basic.lookup.argdep
|
| 343 |
-
[basic.lookup.elab]: #basic.lookup.elab
|
| 344 |
-
[basic.lookup.general]: #basic.lookup.general
|
| 345 |
-
[basic.lookup.qual]: #basic.lookup.qual
|
| 346 |
-
[basic.lookup.qual.general]: #basic.lookup.qual.general
|
| 347 |
-
[basic.lookup.udir]: #basic.lookup.udir
|
| 348 |
-
[basic.lookup.unqual]: #basic.lookup.unqual
|
| 349 |
-
[basic.lval]: expr.md#basic.lval
|
| 350 |
-
[basic.memobj]: #basic.memobj
|
| 351 |
-
[basic.namespace]: dcl.md#basic.namespace
|
| 352 |
-
[basic.pre]: #basic.pre
|
| 353 |
-
[basic.scope]: #basic.scope
|
| 354 |
-
[basic.scope.block]: #basic.scope.block
|
| 355 |
-
[basic.scope.class]: #basic.scope.class
|
| 356 |
-
[basic.scope.enum]: #basic.scope.enum
|
| 357 |
-
[basic.scope.lambda]: #basic.scope.lambda
|
| 358 |
-
[basic.scope.namespace]: #basic.scope.namespace
|
| 359 |
-
[basic.scope.param]: #basic.scope.param
|
| 360 |
-
[basic.scope.pdecl]: #basic.scope.pdecl
|
| 361 |
-
[basic.scope.scope]: #basic.scope.scope
|
| 362 |
-
[basic.scope.temp]: #basic.scope.temp
|
| 363 |
-
[basic.start]: #basic.start
|
| 364 |
-
[basic.start.dynamic]: #basic.start.dynamic
|
| 365 |
-
[basic.start.main]: #basic.start.main
|
| 366 |
-
[basic.start.static]: #basic.start.static
|
| 367 |
-
[basic.start.term]: #basic.start.term
|
| 368 |
-
[basic.stc]: #basic.stc
|
| 369 |
-
[basic.stc.auto]: #basic.stc.auto
|
| 370 |
-
[basic.stc.dynamic]: #basic.stc.dynamic
|
| 371 |
-
[basic.stc.dynamic.allocation]: #basic.stc.dynamic.allocation
|
| 372 |
-
[basic.stc.dynamic.deallocation]: #basic.stc.dynamic.deallocation
|
| 373 |
-
[basic.stc.dynamic.general]: #basic.stc.dynamic.general
|
| 374 |
-
[basic.stc.general]: #basic.stc.general
|
| 375 |
-
[basic.stc.inherit]: #basic.stc.inherit
|
| 376 |
-
[basic.stc.static]: #basic.stc.static
|
| 377 |
-
[basic.stc.thread]: #basic.stc.thread
|
| 378 |
-
[basic.type.qualifier]: #basic.type.qualifier
|
| 379 |
-
[basic.type.qualifier.rel]: #basic.type.qualifier.rel
|
| 380 |
-
[basic.types]: #basic.types
|
| 381 |
-
[basic.types.general]: #basic.types.general
|
| 382 |
-
[bit.cast]: utilities.md#bit.cast
|
| 383 |
-
[c.malloc]: mem.md#c.malloc
|
| 384 |
-
[class]: class.md#class
|
| 385 |
-
[class.abstract]: class.md#class.abstract
|
| 386 |
-
[class.access]: class.md#class.access
|
| 387 |
-
[class.access.base]: class.md#class.access.base
|
| 388 |
-
[class.base.init]: class.md#class.base.init
|
| 389 |
-
[class.bit]: class.md#class.bit
|
| 390 |
-
[class.cdtor]: class.md#class.cdtor
|
| 391 |
-
[class.conv.fct]: class.md#class.conv.fct
|
| 392 |
-
[class.copy.assign]: class.md#class.copy.assign
|
| 393 |
-
[class.copy.ctor]: class.md#class.copy.ctor
|
| 394 |
-
[class.copy.elision]: class.md#class.copy.elision
|
| 395 |
-
[class.default.ctor]: class.md#class.default.ctor
|
| 396 |
-
[class.derived]: class.md#class.derived
|
| 397 |
-
[class.dtor]: class.md#class.dtor
|
| 398 |
-
[class.free]: class.md#class.free
|
| 399 |
-
[class.friend]: class.md#class.friend
|
| 400 |
-
[class.mem]: class.md#class.mem
|
| 401 |
-
[class.member.lookup]: #class.member.lookup
|
| 402 |
-
[class.mfct]: class.md#class.mfct
|
| 403 |
-
[class.mfct.non.static]: class.md#class.mfct.non.static
|
| 404 |
-
[class.name]: class.md#class.name
|
| 405 |
-
[class.pre]: class.md#class.pre
|
| 406 |
-
[class.prop]: class.md#class.prop
|
| 407 |
-
[class.qual]: #class.qual
|
| 408 |
-
[class.spaceship]: class.md#class.spaceship
|
| 409 |
-
[class.static]: class.md#class.static
|
| 410 |
-
[class.static.data]: class.md#class.static.data
|
| 411 |
-
[class.temporary]: #class.temporary
|
| 412 |
-
[class.union]: class.md#class.union
|
| 413 |
-
[class.union.anon]: class.md#class.union.anon
|
| 414 |
-
[class.virtual]: class.md#class.virtual
|
| 415 |
-
[conv]: expr.md#conv
|
| 416 |
-
[conv.array]: expr.md#conv.array
|
| 417 |
-
[conv.func]: expr.md#conv.func
|
| 418 |
-
[conv.integral]: expr.md#conv.integral
|
| 419 |
-
[conv.lval]: expr.md#conv.lval
|
| 420 |
-
[conv.mem]: expr.md#conv.mem
|
| 421 |
-
[conv.prom]: expr.md#conv.prom
|
| 422 |
-
[conv.ptr]: expr.md#conv.ptr
|
| 423 |
-
[conv.rank]: #conv.rank
|
| 424 |
-
[conv.rval]: expr.md#conv.rval
|
| 425 |
-
[cpp.predefined]: cpp.md#cpp.predefined
|
| 426 |
-
[cstddef.syn]: support.md#cstddef.syn
|
| 427 |
-
[cstring.syn]: strings.md#cstring.syn
|
| 428 |
-
[dcl.align]: dcl.md#dcl.align
|
| 429 |
-
[dcl.array]: dcl.md#dcl.array
|
| 430 |
-
[dcl.attr]: dcl.md#dcl.attr
|
| 431 |
-
[dcl.attr.nouniqueaddr]: dcl.md#dcl.attr.nouniqueaddr
|
| 432 |
-
[dcl.constexpr]: dcl.md#dcl.constexpr
|
| 433 |
-
[dcl.dcl]: dcl.md#dcl.dcl
|
| 434 |
-
[dcl.decl]: dcl.md#dcl.decl
|
| 435 |
-
[dcl.enum]: dcl.md#dcl.enum
|
| 436 |
-
[dcl.fct]: dcl.md#dcl.fct
|
| 437 |
-
[dcl.fct.def]: dcl.md#dcl.fct.def
|
| 438 |
-
[dcl.fct.def.coroutine]: dcl.md#dcl.fct.def.coroutine
|
| 439 |
-
[dcl.fct.def.general]: dcl.md#dcl.fct.def.general
|
| 440 |
-
[dcl.fct.default]: dcl.md#dcl.fct.default
|
| 441 |
-
[dcl.init]: dcl.md#dcl.init
|
| 442 |
-
[dcl.init.aggr]: dcl.md#dcl.init.aggr
|
| 443 |
-
[dcl.init.list]: dcl.md#dcl.init.list
|
| 444 |
-
[dcl.init.ref]: dcl.md#dcl.init.ref
|
| 445 |
-
[dcl.link]: dcl.md#dcl.link
|
| 446 |
-
[dcl.meaning]: dcl.md#dcl.meaning
|
| 447 |
-
[dcl.mptr]: dcl.md#dcl.mptr
|
| 448 |
-
[dcl.name]: dcl.md#dcl.name
|
| 449 |
-
[dcl.pre]: dcl.md#dcl.pre
|
| 450 |
-
[dcl.ptr]: dcl.md#dcl.ptr
|
| 451 |
-
[dcl.ref]: dcl.md#dcl.ref
|
| 452 |
-
[dcl.spec]: dcl.md#dcl.spec
|
| 453 |
-
[dcl.spec.auto]: dcl.md#dcl.spec.auto
|
| 454 |
-
[dcl.stc]: dcl.md#dcl.stc
|
| 455 |
-
[dcl.struct.bind]: dcl.md#dcl.struct.bind
|
| 456 |
-
[dcl.type.decltype]: dcl.md#dcl.type.decltype
|
| 457 |
-
[dcl.type.elab]: dcl.md#dcl.type.elab
|
| 458 |
-
[dcl.typedef]: dcl.md#dcl.typedef
|
| 459 |
-
[defns.block]: intro.md#defns.block
|
| 460 |
-
[depr.local]: future.md#depr.local
|
| 461 |
-
[depr.static.constexpr]: future.md#depr.static.constexpr
|
| 462 |
-
[diff.cpp11.basic]: compatibility.md#diff.cpp11.basic
|
| 463 |
-
[enum.udecl]: dcl.md#enum.udecl
|
| 464 |
-
[except.handle]: except.md#except.handle
|
| 465 |
-
[except.pre]: except.md#except.pre
|
| 466 |
-
[except.spec]: except.md#except.spec
|
| 467 |
-
[except.terminate]: except.md#except.terminate
|
| 468 |
-
[except.throw]: except.md#except.throw
|
| 469 |
-
[expr.add]: expr.md#expr.add
|
| 470 |
-
[expr.alignof]: expr.md#expr.alignof
|
| 471 |
-
[expr.arith.conv]: expr.md#expr.arith.conv
|
| 472 |
-
[expr.ass]: expr.md#expr.ass
|
| 473 |
-
[expr.await]: expr.md#expr.await
|
| 474 |
-
[expr.call]: expr.md#expr.call
|
| 475 |
-
[expr.cast]: expr.md#expr.cast
|
| 476 |
-
[expr.comma]: expr.md#expr.comma
|
| 477 |
-
[expr.cond]: expr.md#expr.cond
|
| 478 |
-
[expr.const]: expr.md#expr.const
|
| 479 |
-
[expr.const.cast]: expr.md#expr.const.cast
|
| 480 |
-
[expr.context]: expr.md#expr.context
|
| 481 |
-
[expr.delete]: expr.md#expr.delete
|
| 482 |
-
[expr.dynamic.cast]: expr.md#expr.dynamic.cast
|
| 483 |
-
[expr.eq]: expr.md#expr.eq
|
| 484 |
-
[expr.log.and]: expr.md#expr.log.and
|
| 485 |
-
[expr.log.or]: expr.md#expr.log.or
|
| 486 |
-
[expr.mptr.oper]: expr.md#expr.mptr.oper
|
| 487 |
-
[expr.new]: expr.md#expr.new
|
| 488 |
-
[expr.pre]: expr.md#expr.pre
|
| 489 |
-
[expr.prim.id]: expr.md#expr.prim.id
|
| 490 |
-
[expr.prim.id.qual]: expr.md#expr.prim.id.qual
|
| 491 |
-
[expr.prim.id.unqual]: expr.md#expr.prim.id.unqual
|
| 492 |
-
[expr.prim.lambda]: expr.md#expr.prim.lambda
|
| 493 |
-
[expr.prim.lambda.capture]: expr.md#expr.prim.lambda.capture
|
| 494 |
-
[expr.prim.lambda.closure]: expr.md#expr.prim.lambda.closure
|
| 495 |
-
[expr.prim.this]: expr.md#expr.prim.this
|
| 496 |
-
[expr.prop]: expr.md#expr.prop
|
| 497 |
-
[expr.ref]: expr.md#expr.ref
|
| 498 |
-
[expr.reinterpret.cast]: expr.md#expr.reinterpret.cast
|
| 499 |
-
[expr.rel]: expr.md#expr.rel
|
| 500 |
-
[expr.sizeof]: expr.md#expr.sizeof
|
| 501 |
-
[expr.static.cast]: expr.md#expr.static.cast
|
| 502 |
-
[expr.sub]: expr.md#expr.sub
|
| 503 |
-
[expr.type.conv]: expr.md#expr.type.conv
|
| 504 |
-
[expr.typeid]: expr.md#expr.typeid
|
| 505 |
-
[expr.unary.op]: expr.md#expr.unary.op
|
| 506 |
-
[get.new.handler]: support.md#get.new.handler
|
| 507 |
-
[headers]: library.md#headers
|
| 508 |
-
[intro.execution]: #intro.execution
|
| 509 |
-
[intro.memory]: #intro.memory
|
| 510 |
-
[intro.multithread]: #intro.multithread
|
| 511 |
-
[intro.multithread.general]: #intro.multithread.general
|
| 512 |
-
[intro.object]: #intro.object
|
| 513 |
-
[intro.progress]: #intro.progress
|
| 514 |
-
[intro.races]: #intro.races
|
| 515 |
-
[lex.charset]: lex.md#lex.charset
|
| 516 |
-
[lex.fcon]: lex.md#lex.fcon
|
| 517 |
-
[lex.name]: lex.md#lex.name
|
| 518 |
-
[lex.separate]: lex.md#lex.separate
|
| 519 |
-
[module.context]: module.md#module.context
|
| 520 |
-
[module.global.frag]: module.md#module.global.frag
|
| 521 |
-
[module.interface]: module.md#module.interface
|
| 522 |
-
[module.reach]: module.md#module.reach
|
| 523 |
-
[module.unit]: module.md#module.unit
|
| 524 |
-
[multibyte.strings]: library.md#multibyte.strings
|
| 525 |
-
[namespace.def]: dcl.md#namespace.def
|
| 526 |
-
[namespace.qual]: #namespace.qual
|
| 527 |
-
[namespace.udecl]: dcl.md#namespace.udecl
|
| 528 |
-
[namespace.udir]: dcl.md#namespace.udir
|
| 529 |
-
[namespace.unnamed]: dcl.md#namespace.unnamed
|
| 530 |
-
[new.delete]: support.md#new.delete
|
| 531 |
-
[new.delete.array]: support.md#new.delete.array
|
| 532 |
-
[new.delete.placement]: support.md#new.delete.placement
|
| 533 |
-
[new.delete.single]: support.md#new.delete.single
|
| 534 |
-
[new.handler]: support.md#new.handler
|
| 535 |
-
[new.syn]: support.md#new.syn
|
| 536 |
-
[obj.lifetime]: mem.md#obj.lifetime
|
| 537 |
-
[over]: over.md#over
|
| 538 |
-
[over.literal]: over.md#over.literal
|
| 539 |
-
[over.match]: over.md#over.match
|
| 540 |
-
[over.match.funcs]: over.md#over.match.funcs
|
| 541 |
-
[over.oper]: over.md#over.oper
|
| 542 |
-
[over.over]: over.md#over.over
|
| 543 |
-
[ptr.align]: mem.md#ptr.align
|
| 544 |
-
[ptr.launder]: support.md#ptr.launder
|
| 545 |
-
[replacement.functions]: library.md#replacement.functions
|
| 546 |
-
[special]: class.md#special
|
| 547 |
-
[std.modules]: library.md#std.modules
|
| 548 |
-
[stdfloat.syn]: support.md#stdfloat.syn
|
| 549 |
-
[stmt.block]: stmt.md#stmt.block
|
| 550 |
-
[stmt.dcl]: stmt.md#stmt.dcl
|
| 551 |
-
[stmt.expr]: stmt.md#stmt.expr
|
| 552 |
-
[stmt.if]: stmt.md#stmt.if
|
| 553 |
-
[stmt.iter]: stmt.md#stmt.iter
|
| 554 |
-
[stmt.pre]: stmt.md#stmt.pre
|
| 555 |
-
[stmt.ranged]: stmt.md#stmt.ranged
|
| 556 |
-
[stmt.return]: stmt.md#stmt.return
|
| 557 |
-
[stmt.select]: stmt.md#stmt.select
|
| 558 |
-
[support.dynamic]: support.md#support.dynamic
|
| 559 |
-
[support.runtime]: support.md#support.runtime
|
| 560 |
-
[support.start.term]: support.md#support.start.term
|
| 561 |
-
[support.types]: support.md#support.types
|
| 562 |
-
[temp.concept]: temp.md#temp.concept
|
| 563 |
-
[temp.deduct.guide]: temp.md#temp.deduct.guide
|
| 564 |
-
[temp.dep]: temp.md#temp.dep
|
| 565 |
-
[temp.dep.candidate]: temp.md#temp.dep.candidate
|
| 566 |
-
[temp.dep.constexpr]: temp.md#temp.dep.constexpr
|
| 567 |
-
[temp.dep.type]: temp.md#temp.dep.type
|
| 568 |
-
[temp.expl.spec]: temp.md#temp.expl.spec
|
| 569 |
-
[temp.explicit]: temp.md#temp.explicit
|
| 570 |
-
[temp.friend]: temp.md#temp.friend
|
| 571 |
-
[temp.local]: temp.md#temp.local
|
| 572 |
-
[temp.names]: temp.md#temp.names
|
| 573 |
-
[temp.over]: temp.md#temp.over
|
| 574 |
-
[temp.over.link]: temp.md#temp.over.link
|
| 575 |
-
[temp.param]: temp.md#temp.param
|
| 576 |
-
[temp.point]: temp.md#temp.point
|
| 577 |
-
[temp.pre]: temp.md#temp.pre
|
| 578 |
-
[temp.res]: temp.md#temp.res
|
| 579 |
-
[temp.spec]: temp.md#temp.spec
|
| 580 |
-
[temp.spec.partial]: temp.md#temp.spec.partial
|
| 581 |
-
[temp.type]: temp.md#temp.type
|
| 582 |
-
[term.incomplete.type]: #term.incomplete.type
|
| 583 |
-
[term.odr.use]: #term.odr.use
|
| 584 |
-
[term.unevaluated.operand]: expr.md#term.unevaluated.operand
|
| 585 |
-
[thread]: thread.md#thread
|
| 586 |
-
[thread.jthread.class]: thread.md#thread.jthread.class
|
| 587 |
-
[thread.thread.class]: thread.md#thread.thread.class
|
| 588 |
-
[thread.threads]: thread.md#thread.threads
|
| 589 |
-
|
| 590 |
-
[^1]: Appearing inside the brace-enclosed *declaration-seq* in a
|
| 591 |
-
*linkage-specification* does not affect whether a declaration is a
|
| 592 |
-
definition.
|
| 593 |
-
|
| 594 |
-
[^2]: An implementation is not required to call allocation and
|
| 595 |
-
deallocation functions from constructors or destructors; however,
|
| 596 |
-
this is a permissible implementation technique.
|
| 597 |
-
|
| 598 |
-
[^3]: An implicit object parameter [[over.match.funcs]] is not part of
|
| 599 |
-
the parameter-type-list.
|
| 600 |
-
|
| 601 |
-
[^4]: Lookups in which function names are ignored include names
|
| 602 |
-
appearing in a *nested-name-specifier*, an
|
| 603 |
-
*elaborated-type-specifier*, or a *base-specifier*.
|
| 604 |
-
|
| 605 |
-
[^5]: Unicode® is a registered trademark of Unicode, Inc. This
|
| 606 |
-
information is given for the convenience of users of this document
|
| 607 |
-
and does not constitute an endorsement by ISO or IEC of this
|
| 608 |
-
product.
|
| 609 |
-
|
| 610 |
-
[^6]: The number of bits in a byte is reported by the macro `CHAR_BIT`
|
| 611 |
-
in the header `<climits>`.
|
| 612 |
-
|
| 613 |
-
[^7]: Under the “as-if” rule an implementation is allowed to store two
|
| 614 |
-
objects at the same machine address or not store an object at all if
|
| 615 |
-
the program cannot observe the difference [[intro.execution]].
|
| 616 |
-
|
| 617 |
-
[^8]: For example, before the dynamic initialization of an object with
|
| 618 |
-
static storage duration [[basic.start.dynamic]].
|
| 619 |
-
|
| 620 |
-
[^9]: That is, an object for which a destructor will be called
|
| 621 |
-
implicitly—upon exit from the block for an object with automatic
|
| 622 |
-
storage duration, upon exit from the thread for an object with
|
| 623 |
-
thread storage duration, or upon exit from the program for an object
|
| 624 |
-
with static storage duration.
|
| 625 |
-
|
| 626 |
-
[^10]: Some implementations might define that copying an invalid pointer
|
| 627 |
-
value causes a system-generated runtime fault.
|
| 628 |
-
|
| 629 |
-
[^11]: The intent is to have `operator new()` implementable by calling
|
| 630 |
-
`std::malloc()` or `std::calloc()`, so the rules are substantially
|
| 631 |
-
the same. C++ differs from C in requiring a zero request to return a
|
| 632 |
-
non-null pointer.
|
| 633 |
-
|
| 634 |
-
[^12]: The global `operator delete(void*, std::size_t)` precludes use of
|
| 635 |
-
an allocation function `void operator new(std::size_t, std::size_t)`
|
| 636 |
-
as a placement allocation function [[diff.cpp11.basic]].
|
| 637 |
-
|
| 638 |
-
[^13]: The same rules apply to initialization of an `initializer_list`
|
| 639 |
-
object [[dcl.init.list]] with its underlying temporary array.
|
| 640 |
-
|
| 641 |
-
[^14]: By using, for example, the library functions [[headers]]
|
| 642 |
-
`std::memcpy` or `std::memmove`.
|
| 643 |
-
|
| 644 |
-
[^15]: By using, for example, the library functions [[headers]]
|
| 645 |
-
`std::memcpy` or `std::memmove`.
|
| 646 |
-
|
| 647 |
-
[^16]: The intent is that the memory model of C++ is compatible with
|
| 648 |
-
that of ISO/IEC 9899 Programming Language C.
|
| 649 |
-
|
| 650 |
-
[^17]: The size and layout of an instance of an incompletely-defined
|
| 651 |
-
object type is unknown.
|
| 652 |
-
|
| 653 |
-
[^18]: This is also known as two’s complement representation.
|
| 654 |
-
|
| 655 |
-
[^19]: Static class members are objects or functions, and pointers to
|
| 656 |
-
them are ordinary pointers to objects or functions.
|
| 657 |
-
|
| 658 |
-
[^20]: For an object that is not within its lifetime, this is the first
|
| 659 |
-
byte in memory that it will occupy or used to occupy.
|
| 660 |
-
|
| 661 |
-
[^21]: The same representation and alignment requirements are meant to
|
| 662 |
-
imply interchangeability as arguments to functions, return values
|
| 663 |
-
from functions, and non-static data members of unions.
|
| 664 |
-
|
| 665 |
-
[^22]: As specified in [[class.temporary]], after a full-expression is
|
| 666 |
-
evaluated, a sequence of zero or more invocations of destructor
|
| 667 |
-
functions for temporary objects takes place, usually in reverse
|
| 668 |
-
order of the construction of each temporary object.
|
| 669 |
-
|
| 670 |
-
[^23]: In other words, function executions do not interleave with each
|
| 671 |
-
other.
|
| 672 |
-
|
| 673 |
-
[^24]: An object with automatic or thread storage duration [[basic.stc]]
|
| 674 |
-
is associated with one specific thread, and can be accessed by a
|
| 675 |
-
different thread only indirectly through a pointer or reference
|
| 676 |
-
[[basic.compound]].
|
| 677 |
-
|
| 678 |
-
[^25]: A non-block variable with static storage duration having
|
| 679 |
-
initialization with side effects is initialized in this case, even
|
| 680 |
-
if it is not itself odr-used [[term.odr.use]], [[basic.stc.static]].
|
|
|
|
| 28 |
arguments passed to the program from the environment in which the
|
| 29 |
program is run. If `argc` is nonzero these arguments shall be supplied
|
| 30 |
in `argv[0]` through `argv[argc - 1]` as pointers to the initial
|
| 31 |
characters of null-terminated multibyte strings (NTMBSs)
|
| 32 |
[[multibyte.strings]] and `argv[0]` shall be the pointer to the initial
|
| 33 |
+
character of an NTMBS that represents the name used to invoke the
|
| 34 |
+
program or `""`. The value of `argc` shall be non-negative. The value of
|
| 35 |
`argv[argc]` shall be 0.
|
| 36 |
|
| 37 |
*Recommended practice:* Any further (optional) parameters should be
|
| 38 |
added after `argv`.
|
| 39 |
|
| 40 |
+
The function `main` shall not be named by an expression. The linkage
|
| 41 |
[[basic.link]] of `main` is *implementation-defined*. A program that
|
| 42 |
defines `main` as deleted or that declares `main` to be `inline`,
|
| 43 |
`static`, `constexpr`, or `consteval` is ill-formed. The function `main`
|
| 44 |
shall not be a coroutine [[dcl.fct.def.coroutine]]. The `main` function
|
| 45 |
+
shall not be declared with a *linkage-specification* [[dcl.link]] other
|
| 46 |
+
than `"C++"`. A program that declares
|
| 47 |
|
| 48 |
- a variable `main` that belongs to the global scope, or
|
| 49 |
- a function `main` that belongs to the global scope and is attached to
|
| 50 |
a named module, or
|
| 51 |
- a function template `main` that belongs to the global scope, or
|
|
|
|
| 61 |
destroy any objects with automatic storage duration [[class.dtor]]. If
|
| 62 |
`std::exit` is invoked during the destruction of an object with static
|
| 63 |
or thread storage duration, the program has undefined behavior.
|
| 64 |
|
| 65 |
A `return` statement [[stmt.return]] in `main` has the effect of leaving
|
| 66 |
+
the `main` function (destroying any objects with automatic storage
|
| 67 |
+
duration and evaluating any postcondition assertions of `main`) and
|
| 68 |
+
calling `std::exit` with the return value as the argument. If control
|
| 69 |
+
flows off the end of the *compound-statement* of `main`, the effect is
|
| 70 |
+
equivalent to a `return` with operand `0` (see also [[except.handle]]).
|
| 71 |
|
| 72 |
#### Static initialization <a id="basic.start.static">[[basic.start.static]]</a>
|
| 73 |
|
| 74 |
Variables with static storage duration are initialized as a consequence
|
| 75 |
of program initiation. Variables with thread storage duration are
|
| 76 |
initialized as a consequence of thread execution. Within each of these
|
| 77 |
phases of initiation, initialization occurs as follows.
|
| 78 |
|
| 79 |
+
*Constant initialization* is performed if a variable with static or
|
| 80 |
+
thread storage duration is constant-initialized [[expr.const]]. If
|
| 81 |
+
constant initialization is not performed, a variable with static storage
|
| 82 |
+
duration [[basic.stc.static]] or thread storage duration
|
| 83 |
+
[[basic.stc.thread]] is zero-initialized [[dcl.init]]. Together,
|
| 84 |
+
zero-initialization and constant initialization are called
|
| 85 |
*static initialization*; all other initialization is
|
| 86 |
*dynamic initialization*. All static initialization strongly happens
|
| 87 |
before [[intro.races]] any dynamic initialization.
|
| 88 |
|
| 89 |
[*Note 1*: The dynamic initialization of non-block variables is
|
|
|
|
| 176 |
It is *implementation-defined* whether the dynamic initialization of a
|
| 177 |
non-block non-inline variable with static storage duration is sequenced
|
| 178 |
before the first statement of `main` or is deferred. If it is deferred,
|
| 179 |
it strongly happens before any non-initialization odr-use of any
|
| 180 |
non-inline function or non-inline variable defined in the same
|
| 181 |
+
translation unit as the variable to be initialized.[^24]
|
| 182 |
|
| 183 |
It is *implementation-defined* in which threads and at which points in
|
| 184 |
the program such deferred dynamic initialization occurs.
|
| 185 |
|
| 186 |
*Recommended practice:* An implementation should choose such points in a
|
|
|
|
| 316 |
|
| 317 |
Calling the function `std::abort()` declared in `<cstdlib>` terminates
|
| 318 |
the program without executing any destructors and without calling the
|
| 319 |
functions passed to `std::atexit()` or `std::at_quick_exit()`.
|
| 320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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