tmp/tmpcq2obegm/{from.md → to.md}
RENAMED
|
@@ -1,46 +1,46 @@
|
|
| 1 |
-
##
|
| 2 |
|
| 3 |
-
[*Note 1*: The header `<cstdlib>`
|
| 4 |
-
|
| 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()`
|
| 16 |
-
function `_Exit` is signal-safe
|
| 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()`
|
| 28 |
-
function `abort` is signal-safe
|
| 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
|
| 39 |
|
| 40 |
[*Note 1*: The `atexit()` functions do not introduce a data
|
| 41 |
-
race
|
| 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
|
|
@@ -54,15 +54,15 @@ succeeds, nonzero if it fails.
|
|
| 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
|
| 59 |
-
destructions and calls. (
|
| 60 |
-
result of calling `exit()`.)[^31] If control leaves
|
| 61 |
-
function called by `exit` because the function does not
|
| 62 |
-
handler for a thrown exception,
|
| 63 |
-
called
|
| 64 |
- Next, all open C streams (as mediated by the function signatures
|
| 65 |
declared in `<cstdio>`) with unwritten buffered data are flushed, all
|
| 66 |
open C streams are closed, and all files created by calling
|
| 67 |
`tmpfile()` are removed.
|
| 68 |
- Finally, control is returned to the host environment. If `status` is
|
|
@@ -78,14 +78,14 @@ 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
|
| 84 |
|
| 85 |
[*Note 2*: The `at_quick_exit()` functions do not introduce a data
|
| 86 |
-
race
|
| 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
|
|
@@ -105,23 +105,21 @@ registration of at least 32 functions.
|
|
| 105 |
in the reverse order of their registration, except that a function shall
|
| 106 |
be called after any previously registered functions that had already
|
| 107 |
been called at the time it was registered. Objects shall not be
|
| 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
|
| 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 |
-
|
| 122 |
-
|
| 123 |
-
*Remarks:* The function `quick_exit` is signal-safe ([[csignal.syn]])
|
| 124 |
when the functions registered with `at_quick_exit` are.
|
| 125 |
|
| 126 |
-
|
| 127 |
|
|
|
|
| 1 |
+
## Startup and termination <a id="support.start.term">[[support.start.term]]</a>
|
| 2 |
|
| 3 |
+
[*Note 1*: The header `<cstdlib>` declares the functions described in
|
| 4 |
+
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 [[support.signal]].
|
| 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 [[support.signal]].
|
| 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
|
|
|
|
| 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
|
| 59 |
+
destructions and calls. (Objects with automatic storage duration are
|
| 60 |
+
not destroyed as a result of calling `exit()`.)[^31] If control leaves
|
| 61 |
+
a registered function called by `exit` because the function does not
|
| 62 |
+
provide a handler for a thrown exception, the function
|
| 63 |
+
`std::terminate` shall be called [[except.terminate]].
|
| 64 |
- Next, all open C streams (as mediated by the function signatures
|
| 65 |
declared in `<cstdio>`) with unwritten buffered data are flushed, all
|
| 66 |
open C streams are closed, and all files created by calling
|
| 67 |
`tmpfile()` are removed.
|
| 68 |
- Finally, control is returned to the host environment. If `status` is
|
|
|
|
| 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
|
|
|
|
| 105 |
in the reverse order of their registration, except that a function shall
|
| 106 |
be called after any previously registered functions that had already
|
| 107 |
been called at the time it was registered. Objects shall not be
|
| 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, the function `std::terminate`
|
| 111 |
+
shall be 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 |
+
*Remarks:* The function `quick_exit` is signal-safe [[support.signal]]
|
|
|
|
|
|
|
| 122 |
when the functions registered with `at_quick_exit` are.
|
| 123 |
|
| 124 |
+
See also: ISO C 7.22.4
|
| 125 |
|