tmp/tmp44ifhlz_/{from.md → to.md}
RENAMED
|
@@ -1,59 +1,58 @@
|
|
| 1 |
## Start and termination <a id="support.start.term">[[support.start.term]]</a>
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
The contents are the same as the Standard C library header `<stdlib.h>`,
|
| 7 |
-
with the following changes:
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
[[noreturn]] void _Exit(int status) noexcept;
|
| 11 |
```
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
-
[[noreturn]] void abort(
|
| 22 |
```
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 30 |
|
| 31 |
``` cpp
|
| 32 |
-
|
| 33 |
-
|
| 34 |
```
|
| 35 |
|
| 36 |
*Effects:* The `atexit()` functions register the function pointed to by
|
| 37 |
`f` to be called without arguments at normal program termination. It is
|
| 38 |
unspecified whether a call to `atexit()` that does not happen
|
| 39 |
-
before ([[intro.multithread]]) a call to `exit()` will succeed.
|
| 40 |
-
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
*Implementation limits:* The implementation shall support the
|
| 44 |
registration of at least 32 functions.
|
| 45 |
|
| 46 |
*Returns:* The `atexit()` function returns zero if the registration
|
| 47 |
-
succeeds,
|
| 48 |
|
| 49 |
``` cpp
|
| 50 |
-
[[noreturn]] void exit(int status)
|
| 51 |
```
|
| 52 |
|
| 53 |
-
|
| 54 |
-
Standard:
|
| 55 |
|
| 56 |
- First, objects with thread storage duration and associated with the
|
| 57 |
current thread are destroyed. Next, objects with static storage
|
| 58 |
duration are destroyed and functions registered by calling `atexit`
|
| 59 |
are called.[^30] See [[basic.start.term]] for the order of
|
|
@@ -72,29 +71,33 @@ Standard:
|
|
| 72 |
an *implementation-defined* form of the status *unsuccessful
|
| 73 |
termination* is returned. Otherwise the status returned is
|
| 74 |
*implementation-defined*.[^32]
|
| 75 |
|
| 76 |
``` cpp
|
| 77 |
-
|
| 78 |
-
|
| 79 |
```
|
| 80 |
|
| 81 |
*Effects:* The `at_quick_exit()` functions register the function pointed
|
| 82 |
to by `f` to be called without arguments when `quick_exit` is called. It
|
| 83 |
is unspecified whether a call to `at_quick_exit()` that does not happen
|
| 84 |
before ([[intro.multithread]]) all calls to `quick_exit` will succeed.
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
*Implementation limits:* The implementation shall support the
|
| 93 |
registration of at least 32 functions.
|
| 94 |
|
| 95 |
-
*Returns:* Zero if the registration succeeds,
|
| 96 |
|
| 97 |
``` cpp
|
| 98 |
[[noreturn]] void quick_exit(int status) noexcept;
|
| 99 |
```
|
| 100 |
|
|
@@ -105,13 +108,20 @@ been called at the time it was registered. Objects shall not be
|
|
| 105 |
destroyed as a result of calling `quick_exit`. If control leaves a
|
| 106 |
registered function called by `quick_exit` because the function does not
|
| 107 |
provide a handler for a thrown exception, `std::terminate()` shall be
|
| 108 |
called.
|
| 109 |
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
standard file buffers are not flushed. ISO C 7.20.4.4.
|
| 115 |
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
|
|
|
| 1 |
## Start and termination <a id="support.start.term">[[support.start.term]]</a>
|
| 2 |
|
| 3 |
+
[*Note 1*: The header `<cstdlib>` ([[cstdlib.syn]]) declares the
|
| 4 |
+
functions described in this subclause. — *end note*]
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
``` cpp
|
| 7 |
[[noreturn]] void _Exit(int status) noexcept;
|
| 8 |
```
|
| 9 |
|
| 10 |
+
*Effects:* This function has the semantics specified in the C standard
|
| 11 |
+
library.
|
| 12 |
|
| 13 |
+
*Remarks:* The program is terminated without executing destructors for
|
| 14 |
+
objects of automatic, thread, or static storage duration and without
|
| 15 |
+
calling functions passed to `atexit()` ([[basic.start.term]]). The
|
| 16 |
+
function `_Exit` is signal-safe ([[csignal.syn]]).
|
| 17 |
|
| 18 |
``` cpp
|
| 19 |
+
[[noreturn]] void abort() noexcept;
|
| 20 |
```
|
| 21 |
|
| 22 |
+
*Effects:* This function has the semantics specified in the C standard
|
| 23 |
+
library.
|
| 24 |
|
| 25 |
+
*Remarks:* The program is terminated without executing destructors for
|
| 26 |
+
objects of automatic, thread, or static storage duration and without
|
| 27 |
+
calling functions passed to `atexit()` ([[basic.start.term]]). The
|
| 28 |
+
function `abort` is signal-safe ([[csignal.syn]]).
|
| 29 |
|
| 30 |
``` cpp
|
| 31 |
+
int atexit(c-atexit-handler* f) noexcept;
|
| 32 |
+
int atexit(atexit-handler* f) noexcept;
|
| 33 |
```
|
| 34 |
|
| 35 |
*Effects:* The `atexit()` functions register the function pointed to by
|
| 36 |
`f` to be called without arguments at normal program termination. It is
|
| 37 |
unspecified whether a call to `atexit()` that does not happen
|
| 38 |
+
before ([[intro.multithread]]) a call to `exit()` will succeed.
|
| 39 |
+
|
| 40 |
+
[*Note 1*: The `atexit()` functions do not introduce a data
|
| 41 |
+
race ([[res.on.data.races]]). — *end note*]
|
| 42 |
|
| 43 |
*Implementation limits:* The implementation shall support the
|
| 44 |
registration of at least 32 functions.
|
| 45 |
|
| 46 |
*Returns:* The `atexit()` function returns zero if the registration
|
| 47 |
+
succeeds, nonzero if it fails.
|
| 48 |
|
| 49 |
``` cpp
|
| 50 |
+
[[noreturn]] void exit(int status);
|
| 51 |
```
|
| 52 |
|
| 53 |
+
*Effects:*
|
|
|
|
| 54 |
|
| 55 |
- First, objects with thread storage duration and associated with the
|
| 56 |
current thread are destroyed. Next, objects with static storage
|
| 57 |
duration are destroyed and functions registered by calling `atexit`
|
| 58 |
are called.[^30] See [[basic.start.term]] for the order of
|
|
|
|
| 71 |
an *implementation-defined* form of the status *unsuccessful
|
| 72 |
termination* is returned. Otherwise the status returned is
|
| 73 |
*implementation-defined*.[^32]
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
+
int at_quick_exit(c-atexit-handler* f) noexcept;
|
| 77 |
+
int at_quick_exit(atexit-handler* f) noexcept;
|
| 78 |
```
|
| 79 |
|
| 80 |
*Effects:* The `at_quick_exit()` functions register the function pointed
|
| 81 |
to by `f` to be called without arguments when `quick_exit` is called. It
|
| 82 |
is unspecified whether a call to `at_quick_exit()` that does not happen
|
| 83 |
before ([[intro.multithread]]) all calls to `quick_exit` will succeed.
|
| 84 |
+
|
| 85 |
+
[*Note 2*: The `at_quick_exit()` functions do not introduce a data
|
| 86 |
+
race ([[res.on.data.races]]). — *end note*]
|
| 87 |
+
|
| 88 |
+
[*Note 3*: The order of registration may be indeterminate if
|
| 89 |
+
`at_quick_exit` was called from more than one thread. — *end note*]
|
| 90 |
+
|
| 91 |
+
[*Note 4*: The `at_quick_exit` registrations are distinct from the
|
| 92 |
+
`atexit` registrations, and applications may need to call both
|
| 93 |
+
registration functions with the same argument. — *end note*]
|
| 94 |
|
| 95 |
*Implementation limits:* The implementation shall support the
|
| 96 |
registration of at least 32 functions.
|
| 97 |
|
| 98 |
+
*Returns:* Zero if the registration succeeds, nonzero if it fails.
|
| 99 |
|
| 100 |
``` cpp
|
| 101 |
[[noreturn]] void quick_exit(int status) noexcept;
|
| 102 |
```
|
| 103 |
|
|
|
|
| 108 |
destroyed as a result of calling `quick_exit`. If control leaves a
|
| 109 |
registered function called by `quick_exit` because the function does not
|
| 110 |
provide a handler for a thrown exception, `std::terminate()` shall be
|
| 111 |
called.
|
| 112 |
|
| 113 |
+
[*Note 5*: A function registered via `at_quick_exit` is invoked by the
|
| 114 |
+
thread that calls `quick_exit`, which can be a different thread than the
|
| 115 |
+
one that registered it, so registered functions should not rely on the
|
| 116 |
+
identity of objects with thread storage duration. — *end note*]
|
|
|
|
| 117 |
|
| 118 |
+
After calling registered functions, `quick_exit` shall call
|
| 119 |
+
`_Exit(status)`.
|
| 120 |
+
|
| 121 |
+
[*Note 6*: The standard file buffers are not flushed. — *end note*]
|
| 122 |
+
|
| 123 |
+
*Remarks:* The function `quick_exit` is signal-safe ([[csignal.syn]])
|
| 124 |
+
when the functions registered with `at_quick_exit` are.
|
| 125 |
+
|
| 126 |
+
[[basic.start]], [[basic.start.term]], ISO C 7.22.4.
|
| 127 |
|