tmp/tmpz8gd5q_m/{from.md → to.md}
RENAMED
|
@@ -1,61 +1,61 @@
|
|
| 1 |
-
### The `std::terminate
|
| 2 |
|
| 3 |
In some situations exception handling must be abandoned for less subtle
|
| 4 |
error handling techniques.
|
| 5 |
|
| 6 |
[*Note 1*:
|
| 7 |
|
| 8 |
These situations are:
|
| 9 |
|
| 10 |
- when the exception handling mechanism, after completing the
|
| 11 |
initialization of the exception object but before activation of a
|
| 12 |
-
handler for the exception
|
| 13 |
exits via an exception, or
|
| 14 |
- when the exception handling mechanism cannot find a handler for a
|
| 15 |
-
thrown exception
|
| 16 |
-
- when the search for a handler
|
| 17 |
outermost block of a function with a non-throwing exception
|
| 18 |
-
specification
|
| 19 |
-
- when the destruction of an object during stack unwinding
|
| 20 |
-
[[except.ctor]]
|
| 21 |
- when initialization of a non-local variable with static or thread
|
| 22 |
-
storage duration
|
| 23 |
- when destruction of an object with static or thread storage duration
|
| 24 |
-
exits via an exception
|
| 25 |
- when execution of a function registered with `std::atexit` or
|
| 26 |
-
`std::at_quick_exit` exits via an exception
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
[[except.throw]]), or
|
| 31 |
- when the function `std::nested_exception::rethrow_nested` is called
|
| 32 |
-
for an object that has captured no exception
|
| 33 |
- when execution of the initial function of a thread exits via an
|
| 34 |
-
exception
|
| 35 |
- for a parallel algorithm whose `ExecutionPolicy` specifies such
|
| 36 |
behavior ([[execpol.seq]], [[execpol.par]], [[execpol.parunseq]]),
|
| 37 |
-
when execution of an element access function
|
| 38 |
-
[[algorithms.parallel.defns]]
|
| 39 |
-
exception
|
| 40 |
-
- when the destructor or the
|
| 41 |
object of type `std::thread` that refers to a joinable thread (
|
| 42 |
-
[[thread.thread.destr]],
|
| 43 |
- when a call to a `wait()`, `wait_until()`, or `wait_for()` function on
|
| 44 |
-
a condition variable ([[thread.condition.condvar]],
|
| 45 |
[[thread.condition.condvarany]]) fails to meet a postcondition.
|
| 46 |
|
| 47 |
— *end note*]
|
| 48 |
|
| 49 |
-
In such cases, `std::terminate
|
| 50 |
-
In the situation where no matching handler is
|
| 51 |
-
*implementation-defined* whether or not the stack is
|
| 52 |
-
`std::terminate
|
| 53 |
-
handler
|
| 54 |
-
function with a non-throwing exception specification
|
| 55 |
it is *implementation-defined* whether the stack is unwound, unwound
|
| 56 |
-
partially, or not unwound at all before `std::terminate
|
| 57 |
-
all other situations, the stack shall not be unwound before
|
| 58 |
-
`std::terminate
|
| 59 |
-
finish stack unwinding prematurely based on a determination
|
| 60 |
-
unwind process will eventually cause a call to
|
|
|
|
| 61 |
|
|
|
|
| 1 |
+
### The `std::terminate` function <a id="except.terminate">[[except.terminate]]</a>
|
| 2 |
|
| 3 |
In some situations exception handling must be abandoned for less subtle
|
| 4 |
error handling techniques.
|
| 5 |
|
| 6 |
[*Note 1*:
|
| 7 |
|
| 8 |
These situations are:
|
| 9 |
|
| 10 |
- when the exception handling mechanism, after completing the
|
| 11 |
initialization of the exception object but before activation of a
|
| 12 |
+
handler for the exception [[except.throw]], calls a function that
|
| 13 |
exits via an exception, or
|
| 14 |
- when the exception handling mechanism cannot find a handler for a
|
| 15 |
+
thrown exception [[except.handle]], or
|
| 16 |
+
- when the search for a handler [[except.handle]] encounters the
|
| 17 |
outermost block of a function with a non-throwing exception
|
| 18 |
+
specification [[except.spec]], or
|
| 19 |
+
- when the destruction of an object during stack unwinding
|
| 20 |
+
[[except.ctor]] terminates by throwing an exception, or
|
| 21 |
- when initialization of a non-local variable with static or thread
|
| 22 |
+
storage duration [[basic.start.dynamic]] exits via an exception, or
|
| 23 |
- when destruction of an object with static or thread storage duration
|
| 24 |
+
exits via an exception [[basic.start.term]], or
|
| 25 |
- when execution of a function registered with `std::atexit` or
|
| 26 |
+
`std::at_quick_exit` exits via an exception [[support.start.term]], or
|
| 27 |
+
- when a *throw-expression* [[expr.throw]] with no operand attempts to
|
| 28 |
+
rethrow an exception and no exception is being handled
|
| 29 |
+
[[except.throw]], or
|
|
|
|
| 30 |
- when the function `std::nested_exception::rethrow_nested` is called
|
| 31 |
+
for an object that has captured no exception [[except.nested]], or
|
| 32 |
- when execution of the initial function of a thread exits via an
|
| 33 |
+
exception [[thread.thread.constr]], or
|
| 34 |
- for a parallel algorithm whose `ExecutionPolicy` specifies such
|
| 35 |
behavior ([[execpol.seq]], [[execpol.par]], [[execpol.parunseq]]),
|
| 36 |
+
when execution of an element access function
|
| 37 |
+
[[algorithms.parallel.defns]] of the parallel algorithm exits via an
|
| 38 |
+
exception [[algorithms.parallel.exceptions]], or
|
| 39 |
+
- when the destructor or the move assignment operator is invoked on an
|
| 40 |
object of type `std::thread` that refers to a joinable thread (
|
| 41 |
+
[[thread.thread.destr]], [[thread.thread.assign]]), or
|
| 42 |
- when a call to a `wait()`, `wait_until()`, or `wait_for()` function on
|
| 43 |
+
a condition variable ([[thread.condition.condvar]],
|
| 44 |
[[thread.condition.condvarany]]) fails to meet a postcondition.
|
| 45 |
|
| 46 |
— *end note*]
|
| 47 |
|
| 48 |
+
In such cases, the function `std::terminate` is called
|
| 49 |
+
[[exception.terminate]]. In the situation where no matching handler is
|
| 50 |
+
found, it is *implementation-defined* whether or not the stack is
|
| 51 |
+
unwound before `std::terminate` is called. In the situation where the
|
| 52 |
+
search for a handler [[except.handle]] encounters the outermost block of
|
| 53 |
+
a function with a non-throwing exception specification [[except.spec]],
|
| 54 |
it is *implementation-defined* whether the stack is unwound, unwound
|
| 55 |
+
partially, or not unwound at all before the function `std::terminate` is
|
| 56 |
+
called. In all other situations, the stack shall not be unwound before
|
| 57 |
+
the function `std::terminate` is called. An implementation is not
|
| 58 |
+
permitted to finish stack unwinding prematurely based on a determination
|
| 59 |
+
that the unwind process will eventually cause a call to the function
|
| 60 |
+
`std::terminate`.
|
| 61 |
|