tmp/tmpx4m93ggi/{from.md → to.md}
RENAMED
|
@@ -1,18 +1,20 @@
|
|
| 1 |
## Special functions <a id="except.special">[[except.special]]</a>
|
| 2 |
|
|
|
|
|
|
|
| 3 |
The function `std::terminate` [[except.terminate]] is used by the
|
| 4 |
exception handling mechanism for coping with errors related to the
|
| 5 |
exception handling mechanism itself. The function
|
| 6 |
`std::current_exception()` [[propagation]] and the class
|
| 7 |
`std::nested_exception` [[except.nested]] can be used by a program to
|
| 8 |
capture the currently handled exception.
|
| 9 |
|
| 10 |
### The `std::terminate` function <a id="except.terminate">[[except.terminate]]</a>
|
| 11 |
|
| 12 |
-
In some situations exception handling
|
| 13 |
-
|
| 14 |
|
| 15 |
[*Note 1*:
|
| 16 |
|
| 17 |
These situations are:
|
| 18 |
|
|
@@ -25,11 +27,11 @@ These situations are:
|
|
| 25 |
- when the search for a handler [[except.handle]] encounters the
|
| 26 |
outermost block of a function with a non-throwing exception
|
| 27 |
specification [[except.spec]], or
|
| 28 |
- when the destruction of an object during stack unwinding
|
| 29 |
[[except.ctor]] terminates by throwing an exception, or
|
| 30 |
-
- when initialization of a non-
|
| 31 |
storage duration [[basic.start.dynamic]] exits via an exception, or
|
| 32 |
- when destruction of an object with static or thread storage duration
|
| 33 |
exits via an exception [[basic.start.term]], or
|
| 34 |
- when execution of a function registered with `std::atexit` or
|
| 35 |
`std::at_quick_exit` exits via an exception [[support.start.term]], or
|
|
@@ -39,78 +41,82 @@ These situations are:
|
|
| 39 |
- when the function `std::nested_exception::rethrow_nested` is called
|
| 40 |
for an object that has captured no exception [[except.nested]], or
|
| 41 |
- when execution of the initial function of a thread exits via an
|
| 42 |
exception [[thread.thread.constr]], or
|
| 43 |
- for a parallel algorithm whose `ExecutionPolicy` specifies such
|
| 44 |
-
behavior
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
- when the destructor or the move assignment operator is invoked on an
|
| 49 |
-
object of type `std::thread` that refers to a joinable thread
|
| 50 |
-
[[thread.thread.destr]], [[thread.thread.assign]]
|
| 51 |
- when a call to a `wait()`, `wait_until()`, or `wait_for()` function on
|
| 52 |
-
a condition variable
|
| 53 |
-
[[thread.condition.condvarany]]
|
|
|
|
| 54 |
|
| 55 |
— *end note*]
|
| 56 |
|
| 57 |
-
In such cases, the function `std::terminate` is
|
| 58 |
[[exception.terminate]]. In the situation where no matching handler is
|
| 59 |
found, it is *implementation-defined* whether or not the stack is
|
| 60 |
-
unwound before `std::terminate` is
|
| 61 |
search for a handler [[except.handle]] encounters the outermost block of
|
| 62 |
a function with a non-throwing exception specification [[except.spec]],
|
| 63 |
it is *implementation-defined* whether the stack is unwound, unwound
|
| 64 |
partially, or not unwound at all before the function `std::terminate` is
|
| 65 |
-
|
| 66 |
-
the function `std::terminate` is
|
| 67 |
permitted to finish stack unwinding prematurely based on a determination
|
| 68 |
-
that the unwind process will eventually cause
|
| 69 |
-
`std::terminate`.
|
| 70 |
|
| 71 |
-
### The `std::uncaught_exceptions
|
| 72 |
|
| 73 |
An exception is considered uncaught after completing the initialization
|
| 74 |
of the exception object [[except.throw]] until completing the activation
|
| 75 |
of a handler for the exception [[except.handle]].
|
| 76 |
|
| 77 |
[*Note 1*: As a consequence, an exception is considered uncaught during
|
| 78 |
any stack unwinding resulting from it being thrown. — *end note*]
|
| 79 |
|
| 80 |
-
If an exception is rethrown
|
| 81 |
considered uncaught from the point of rethrow until the rethrown
|
| 82 |
-
exception is caught. The function `std::uncaught_exceptions
|
| 83 |
[[uncaught.exceptions]] returns the number of uncaught exceptions in the
|
| 84 |
current thread.
|
| 85 |
|
| 86 |
<!-- Link reference definitions -->
|
| 87 |
[algorithms.parallel.defns]: algorithms.md#algorithms.parallel.defns
|
| 88 |
[algorithms.parallel.exceptions]: algorithms.md#algorithms.parallel.exceptions
|
| 89 |
-
[basic.def.odr]: basic.md#basic.def.odr
|
| 90 |
-
[basic.lookup]: basic.md#basic.lookup
|
| 91 |
[basic.start.dynamic]: basic.md#basic.start.dynamic
|
| 92 |
[basic.start.main]: basic.md#basic.start.main
|
| 93 |
[basic.start.term]: basic.md#basic.start.term
|
| 94 |
[basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
|
| 95 |
[basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
|
| 96 |
[class.abstract]: class.md#class.abstract
|
|
|
|
| 97 |
[class.copy.ctor]: class.md#class.copy.ctor
|
| 98 |
[class.copy.elision]: class.md#class.copy.elision
|
| 99 |
[class.dtor]: class.md#class.dtor
|
|
|
|
| 100 |
[conv.fctptr]: expr.md#conv.fctptr
|
| 101 |
[conv.ptr]: expr.md#conv.ptr
|
| 102 |
[conv.qual]: expr.md#conv.qual
|
| 103 |
[dcl.fct]: dcl.md#dcl.fct
|
| 104 |
[dcl.init]: dcl.md#dcl.init
|
|
|
|
|
|
|
| 105 |
[except]: #except
|
| 106 |
[except.ctor]: #except.ctor
|
| 107 |
[except.handle]: #except.handle
|
| 108 |
[except.nested]: support.md#except.nested
|
| 109 |
[except.pre]: #except.pre
|
| 110 |
[except.spec]: #except.spec
|
| 111 |
[except.special]: #except.special
|
|
|
|
| 112 |
[except.terminate]: #except.terminate
|
| 113 |
[except.throw]: #except.throw
|
| 114 |
[except.uncaught]: #except.uncaught
|
| 115 |
[exception.terminate]: support.md#exception.terminate
|
| 116 |
[execpol.par]: utilities.md#execpol.par
|
|
@@ -118,25 +124,28 @@ current thread.
|
|
| 118 |
[execpol.seq]: utilities.md#execpol.seq
|
| 119 |
[expr.call]: expr.md#expr.call
|
| 120 |
[expr.const]: expr.md#expr.const
|
| 121 |
[expr.dynamic.cast]: expr.md#expr.dynamic.cast
|
| 122 |
[expr.new]: expr.md#expr.new
|
|
|
|
| 123 |
[expr.throw]: expr.md#expr.throw
|
| 124 |
[expr.typeid]: expr.md#expr.typeid
|
| 125 |
[futures]: thread.md#futures
|
| 126 |
[intro.execution]: basic.md#intro.execution
|
| 127 |
[intro.races]: basic.md#intro.races
|
| 128 |
[over.binary]: over.md#over.binary
|
| 129 |
[over.match]: over.md#over.match
|
| 130 |
[over.over]: over.md#over.over
|
| 131 |
[propagation]: support.md#propagation
|
| 132 |
[stmt.jump]: stmt.md#stmt.jump
|
|
|
|
| 133 |
[stmt.pre]: stmt.md#stmt.pre
|
| 134 |
[stmt.return]: stmt.md#stmt.return
|
| 135 |
[structure.specifications]: library.md#structure.specifications
|
| 136 |
[support.start.term]: support.md#support.start.term
|
| 137 |
[temp.explicit]: temp.md#temp.explicit
|
|
|
|
| 138 |
[thread.condition.condvar]: thread.md#thread.condition.condvar
|
| 139 |
[thread.condition.condvarany]: thread.md#thread.condition.condvarany
|
| 140 |
[thread.thread.assign]: thread.md#thread.thread.assign
|
| 141 |
[thread.thread.constr]: thread.md#thread.thread.constr
|
| 142 |
[thread.thread.destr]: thread.md#thread.thread.destr
|
|
|
|
| 1 |
## Special functions <a id="except.special">[[except.special]]</a>
|
| 2 |
|
| 3 |
+
### General <a id="except.special.general">[[except.special.general]]</a>
|
| 4 |
+
|
| 5 |
The function `std::terminate` [[except.terminate]] is used by the
|
| 6 |
exception handling mechanism for coping with errors related to the
|
| 7 |
exception handling mechanism itself. The function
|
| 8 |
`std::current_exception()` [[propagation]] and the class
|
| 9 |
`std::nested_exception` [[except.nested]] can be used by a program to
|
| 10 |
capture the currently handled exception.
|
| 11 |
|
| 12 |
### The `std::terminate` function <a id="except.terminate">[[except.terminate]]</a>
|
| 13 |
|
| 14 |
+
In some situations exception handling is abandoned for less subtle error
|
| 15 |
+
handling techniques.
|
| 16 |
|
| 17 |
[*Note 1*:
|
| 18 |
|
| 19 |
These situations are:
|
| 20 |
|
|
|
|
| 27 |
- when the search for a handler [[except.handle]] encounters the
|
| 28 |
outermost block of a function with a non-throwing exception
|
| 29 |
specification [[except.spec]], or
|
| 30 |
- when the destruction of an object during stack unwinding
|
| 31 |
[[except.ctor]] terminates by throwing an exception, or
|
| 32 |
+
- when initialization of a non-block variable with static or thread
|
| 33 |
storage duration [[basic.start.dynamic]] exits via an exception, or
|
| 34 |
- when destruction of an object with static or thread storage duration
|
| 35 |
exits via an exception [[basic.start.term]], or
|
| 36 |
- when execution of a function registered with `std::atexit` or
|
| 37 |
`std::at_quick_exit` exits via an exception [[support.start.term]], or
|
|
|
|
| 41 |
- when the function `std::nested_exception::rethrow_nested` is called
|
| 42 |
for an object that has captured no exception [[except.nested]], or
|
| 43 |
- when execution of the initial function of a thread exits via an
|
| 44 |
exception [[thread.thread.constr]], or
|
| 45 |
- for a parallel algorithm whose `ExecutionPolicy` specifies such
|
| 46 |
+
behavior [[execpol.seq]], [[execpol.par]], [[execpol.parunseq]], when
|
| 47 |
+
execution of an element access function [[algorithms.parallel.defns]]
|
| 48 |
+
of the parallel algorithm exits via an exception
|
| 49 |
+
[[algorithms.parallel.exceptions]], or
|
| 50 |
- when the destructor or the move assignment operator is invoked on an
|
| 51 |
+
object of type `std::thread` that refers to a joinable thread
|
| 52 |
+
[[thread.thread.destr]], [[thread.thread.assign]], or
|
| 53 |
- when a call to a `wait()`, `wait_until()`, or `wait_for()` function on
|
| 54 |
+
a condition variable
|
| 55 |
+
[[thread.condition.condvar]], [[thread.condition.condvarany]] fails to
|
| 56 |
+
meet a postcondition.
|
| 57 |
|
| 58 |
— *end note*]
|
| 59 |
|
| 60 |
+
In such cases, the function `std::terminate` is invoked
|
| 61 |
[[exception.terminate]]. In the situation where no matching handler is
|
| 62 |
found, it is *implementation-defined* whether or not the stack is
|
| 63 |
+
unwound before `std::terminate` is invoked. In the situation where the
|
| 64 |
search for a handler [[except.handle]] encounters the outermost block of
|
| 65 |
a function with a non-throwing exception specification [[except.spec]],
|
| 66 |
it is *implementation-defined* whether the stack is unwound, unwound
|
| 67 |
partially, or not unwound at all before the function `std::terminate` is
|
| 68 |
+
invoked. In all other situations, the stack shall not be unwound before
|
| 69 |
+
the function `std::terminate` is invoked. An implementation is not
|
| 70 |
permitted to finish stack unwinding prematurely based on a determination
|
| 71 |
+
that the unwind process will eventually cause an invocation of the
|
| 72 |
+
function `std::terminate`.
|
| 73 |
|
| 74 |
+
### The `std::uncaught_exceptions` function <a id="except.uncaught">[[except.uncaught]]</a>
|
| 75 |
|
| 76 |
An exception is considered uncaught after completing the initialization
|
| 77 |
of the exception object [[except.throw]] until completing the activation
|
| 78 |
of a handler for the exception [[except.handle]].
|
| 79 |
|
| 80 |
[*Note 1*: As a consequence, an exception is considered uncaught during
|
| 81 |
any stack unwinding resulting from it being thrown. — *end note*]
|
| 82 |
|
| 83 |
+
If an exception is rethrown [[expr.throw]], [[propagation]], it is
|
| 84 |
considered uncaught from the point of rethrow until the rethrown
|
| 85 |
+
exception is caught. The function `std::uncaught_exceptions`
|
| 86 |
[[uncaught.exceptions]] returns the number of uncaught exceptions in the
|
| 87 |
current thread.
|
| 88 |
|
| 89 |
<!-- Link reference definitions -->
|
| 90 |
[algorithms.parallel.defns]: algorithms.md#algorithms.parallel.defns
|
| 91 |
[algorithms.parallel.exceptions]: algorithms.md#algorithms.parallel.exceptions
|
|
|
|
|
|
|
| 92 |
[basic.start.dynamic]: basic.md#basic.start.dynamic
|
| 93 |
[basic.start.main]: basic.md#basic.start.main
|
| 94 |
[basic.start.term]: basic.md#basic.start.term
|
| 95 |
[basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
|
| 96 |
[basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
|
| 97 |
[class.abstract]: class.md#class.abstract
|
| 98 |
+
[class.base.init]: class.md#class.base.init
|
| 99 |
[class.copy.ctor]: class.md#class.copy.ctor
|
| 100 |
[class.copy.elision]: class.md#class.copy.elision
|
| 101 |
[class.dtor]: class.md#class.dtor
|
| 102 |
+
[class.inhctor.init]: class.md#class.inhctor.init
|
| 103 |
[conv.fctptr]: expr.md#conv.fctptr
|
| 104 |
[conv.ptr]: expr.md#conv.ptr
|
| 105 |
[conv.qual]: expr.md#conv.qual
|
| 106 |
[dcl.fct]: dcl.md#dcl.fct
|
| 107 |
[dcl.init]: dcl.md#dcl.init
|
| 108 |
+
[dcl.init.aggr]: dcl.md#dcl.init.aggr
|
| 109 |
+
[dcl.init.general]: dcl.md#dcl.init.general
|
| 110 |
[except]: #except
|
| 111 |
[except.ctor]: #except.ctor
|
| 112 |
[except.handle]: #except.handle
|
| 113 |
[except.nested]: support.md#except.nested
|
| 114 |
[except.pre]: #except.pre
|
| 115 |
[except.spec]: #except.spec
|
| 116 |
[except.special]: #except.special
|
| 117 |
+
[except.special.general]: #except.special.general
|
| 118 |
[except.terminate]: #except.terminate
|
| 119 |
[except.throw]: #except.throw
|
| 120 |
[except.uncaught]: #except.uncaught
|
| 121 |
[exception.terminate]: support.md#exception.terminate
|
| 122 |
[execpol.par]: utilities.md#execpol.par
|
|
|
|
| 124 |
[execpol.seq]: utilities.md#execpol.seq
|
| 125 |
[expr.call]: expr.md#expr.call
|
| 126 |
[expr.const]: expr.md#expr.const
|
| 127 |
[expr.dynamic.cast]: expr.md#expr.dynamic.cast
|
| 128 |
[expr.new]: expr.md#expr.new
|
| 129 |
+
[expr.prim.lambda.capture]: expr.md#expr.prim.lambda.capture
|
| 130 |
[expr.throw]: expr.md#expr.throw
|
| 131 |
[expr.typeid]: expr.md#expr.typeid
|
| 132 |
[futures]: thread.md#futures
|
| 133 |
[intro.execution]: basic.md#intro.execution
|
| 134 |
[intro.races]: basic.md#intro.races
|
| 135 |
[over.binary]: over.md#over.binary
|
| 136 |
[over.match]: over.md#over.match
|
| 137 |
[over.over]: over.md#over.over
|
| 138 |
[propagation]: support.md#propagation
|
| 139 |
[stmt.jump]: stmt.md#stmt.jump
|
| 140 |
+
[stmt.label]: stmt.md#stmt.label
|
| 141 |
[stmt.pre]: stmt.md#stmt.pre
|
| 142 |
[stmt.return]: stmt.md#stmt.return
|
| 143 |
[structure.specifications]: library.md#structure.specifications
|
| 144 |
[support.start.term]: support.md#support.start.term
|
| 145 |
[temp.explicit]: temp.md#temp.explicit
|
| 146 |
+
[term.odr.use]: basic.md#term.odr.use
|
| 147 |
[thread.condition.condvar]: thread.md#thread.condition.condvar
|
| 148 |
[thread.condition.condvarany]: thread.md#thread.condition.condvarany
|
| 149 |
[thread.thread.assign]: thread.md#thread.thread.assign
|
| 150 |
[thread.thread.constr]: thread.md#thread.thread.constr
|
| 151 |
[thread.thread.destr]: thread.md#thread.thread.destr
|