From Jason Turner

[except.special]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp6dikvg0c/{from.md → to.md} +64 -57
tmp/tmp6dikvg0c/{from.md → to.md} RENAMED
@@ -1,85 +1,89 @@
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 must be abandoned for less subtle
13
  error handling techniques.
14
 
15
  [*Note 1*:
16
 
17
  These situations are:
18
 
19
  - when the exception handling mechanism, after completing the
20
  initialization of the exception object but before activation of a
21
- handler for the exception ([[except.throw]]), calls a function that
22
  exits via an exception, or
23
  - when the exception handling mechanism cannot find a handler for a
24
- thrown exception ([[except.handle]]), or
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-local variable with static or thread
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]]),
36
- or
37
- - when a *throw-expression* ([[expr.throw]]) with no operand attempts
38
- to rethrow an exception and no exception is being handled (
39
- [[except.throw]]), or
40
  - when the function `std::nested_exception::rethrow_nested` is called
41
- for an object that has captured no exception ([[except.nested]]), or
42
  - when execution of the initial function of a thread exits via an
43
- exception ([[thread.thread.constr]]), or
44
  - for a parallel algorithm whose `ExecutionPolicy` specifies such
45
  behavior ([[execpol.seq]], [[execpol.par]], [[execpol.parunseq]]),
46
- when execution of an element access function (
47
- [[algorithms.parallel.defns]]) of the parallel algorithm exits via an
48
- exception ([[algorithms.parallel.exceptions]]), or
49
- - when the destructor or the copy assignment operator is invoked on an
50
  object of type `std::thread` that refers to a joinable thread (
51
- [[thread.thread.destr]],  [[thread.thread.assign]]), or
52
  - when a call to a `wait()`, `wait_until()`, or `wait_for()` function on
53
- a condition variable ([[thread.condition.condvar]], 
54
  [[thread.condition.condvarany]]) fails to meet a postcondition.
55
 
56
  — *end note*]
57
 
58
- In such cases, `std::terminate()` is called ([[exception.terminate]]).
59
- In the situation where no matching handler is found, it is
60
- *implementation-defined* whether or not the stack is unwound before
61
- `std::terminate()` is called. In the situation where the search for a
62
- handler ([[except.handle]]) encounters the outermost block of a
63
- function with a non-throwing exception specification ([[except.spec]]),
64
  it is *implementation-defined* whether the stack is unwound, unwound
65
- partially, or not unwound at all before `std::terminate()` is called. In
66
- all other situations, the stack shall not be unwound before
67
- `std::terminate()` is called. An implementation is not permitted to
68
- finish stack unwinding prematurely based on a determination that the
69
- unwind process will eventually cause a call to `std::terminate()`.
 
70
 
71
  ### The `std::uncaught_exceptions()` function <a id="except.uncaught">[[except.uncaught]]</a>
72
 
73
  An exception is considered uncaught after completing the initialization
74
- of the exception object ([[except.throw]]) until completing the
75
- activation of a handler for the exception ([[except.handle]]). This
76
- includes stack unwinding. If an exception is rethrown ([[expr.throw]],
77
- [[propagation]]), it is considered uncaught from the point of rethrow
78
- until the rethrown exception is caught. The function
79
- `std::uncaught_exceptions()` ([[uncaught.exceptions]]) returns the
80
- number of uncaught exceptions in the current thread.
 
 
 
 
81
 
82
  <!-- Link reference definitions -->
83
  [algorithms.parallel.defns]: algorithms.md#algorithms.parallel.defns
84
  [algorithms.parallel.exceptions]: algorithms.md#algorithms.parallel.exceptions
85
  [basic.def.odr]: basic.md#basic.def.odr
@@ -87,50 +91,53 @@ number of uncaught exceptions in the current thread.
87
  [basic.start.dynamic]: basic.md#basic.start.dynamic
88
  [basic.start.main]: basic.md#basic.start.main
89
  [basic.start.term]: basic.md#basic.start.term
90
  [basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
91
  [basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
92
- [class.copy]: special.md#class.copy
93
- [class.dtor]: special.md#class.dtor
94
- [conv.fctptr]: conv.md#conv.fctptr
95
- [conv.ptr]: conv.md#conv.ptr
96
- [conv.qual]: conv.md#conv.qual
 
 
97
  [dcl.fct]: dcl.md#dcl.fct
98
  [dcl.init]: dcl.md#dcl.init
99
- [depr.except.spec]: future.md#depr.except.spec
100
  [except]: #except
101
  [except.ctor]: #except.ctor
102
  [except.handle]: #except.handle
103
- [except.nested]: language.md#except.nested
 
104
  [except.spec]: #except.spec
105
  [except.special]: #except.special
106
  [except.terminate]: #except.terminate
107
  [except.throw]: #except.throw
108
  [except.uncaught]: #except.uncaught
109
- [exception.terminate]: language.md#exception.terminate
110
  [execpol.par]: utilities.md#execpol.par
111
  [execpol.parunseq]: utilities.md#execpol.parunseq
112
  [execpol.seq]: utilities.md#execpol.seq
113
  [expr.call]: expr.md#expr.call
114
  [expr.const]: expr.md#expr.const
115
  [expr.dynamic.cast]: expr.md#expr.dynamic.cast
116
  [expr.new]: expr.md#expr.new
117
  [expr.throw]: expr.md#expr.throw
118
  [expr.typeid]: expr.md#expr.typeid
119
  [futures]: thread.md#futures
120
- [intro.execution]: intro.md#intro.execution
121
- [intro.races]: intro.md#intro.races
 
122
  [over.match]: over.md#over.match
123
  [over.over]: over.md#over.over
124
- [propagation]: language.md#propagation
125
  [stmt.jump]: stmt.md#stmt.jump
 
126
  [stmt.return]: stmt.md#stmt.return
127
- [stmt.stmt]: stmt.md#stmt.stmt
128
  [structure.specifications]: library.md#structure.specifications
129
- [support.start.term]: language.md#support.start.term
130
  [temp.explicit]: temp.md#temp.explicit
131
  [thread.condition.condvar]: thread.md#thread.condition.condvar
132
  [thread.condition.condvarany]: thread.md#thread.condition.condvarany
133
  [thread.thread.assign]: thread.md#thread.thread.assign
134
  [thread.thread.constr]: thread.md#thread.thread.constr
135
  [thread.thread.destr]: thread.md#thread.thread.destr
136
- [uncaught.exceptions]: language.md#uncaught.exceptions
 
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 must be abandoned for less subtle
13
  error handling techniques.
14
 
15
  [*Note 1*:
16
 
17
  These situations are:
18
 
19
  - when the exception handling mechanism, after completing the
20
  initialization of the exception object but before activation of a
21
+ handler for the exception [[except.throw]], calls a function that
22
  exits via an exception, or
23
  - when the exception handling mechanism cannot find a handler for a
24
+ thrown exception [[except.handle]], or
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-local variable with static or thread
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
36
+ - when a *throw-expression* [[expr.throw]] with no operand attempts to
37
+ rethrow an exception and no exception is being handled
38
+ [[except.throw]], or
 
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 ([[execpol.seq]], [[execpol.par]], [[execpol.parunseq]]),
45
+ when execution of an element access function
46
+ [[algorithms.parallel.defns]] of the parallel algorithm exits via an
47
+ exception [[algorithms.parallel.exceptions]], or
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]]), or
51
  - when a call to a `wait()`, `wait_until()`, or `wait_for()` function on
52
+ a condition variable ([[thread.condition.condvar]],
53
  [[thread.condition.condvarany]]) fails to meet a postcondition.
54
 
55
  — *end note*]
56
 
57
+ In such cases, the function `std::terminate` is called
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 called. In the situation where the
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
+ called. In all other situations, the stack shall not be unwound before
66
+ the function `std::terminate` is called. An implementation is not
67
+ permitted to finish stack unwinding prematurely based on a determination
68
+ that the unwind process will eventually cause a call to the function
69
+ `std::terminate`.
70
 
71
  ### The `std::uncaught_exceptions()` function <a id="except.uncaught">[[except.uncaught]]</a>
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 ([[expr.throw]], [[propagation]]), it is
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
 
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
117
  [execpol.parunseq]: utilities.md#execpol.parunseq
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
143
+ [uncaught.exceptions]: support.md#uncaught.exceptions