Skip to content

Commit c3ea389

Browse files
committed
[except.uncaught] Tidy the specification for uncaught exceptions
Several concurrent fixes. First include the normative wording that 'uncaught_exceptions' returns the number of uncaught exceptions *on the current thread*. This wording is present in the core language. Then move the core wording for when an exception is uncaught directly into the text that talks about caught and uncaught exceptions. In the process, turn the reference to into a note, so that there is only one normative specification. Finally, remove [except.uncaught] as it is now empty, and add the missing descriptive sentence to the intro paragraph of [except.special.general]. This happens to produce quite a pleasing page-break, but that is just luck, not design.
1 parent 2b3e09e commit c3ea389

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

source/exceptions.tex

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,30 @@
327327
it is rethrown.
328328
\end{note}
329329

330+
\pnum
331+
An exception is considered uncaught
332+
after completing the initialization of the exception object
333+
until completing the activation of a handler for the exception\iref{except.handle}.
334+
\begin{note}
335+
As a consequence, an exception is considered uncaught
336+
during any stack unwinding resulting from it being thrown.
337+
\end{note}
338+
339+
\pnum
340+
If an exception is rethrown\iref{expr.throw,propagation},
341+
it is considered uncaught from the point of rethrow
342+
until the rethrown exception is caught.
343+
\indexlibraryglobal{uncaught_exceptions}%
344+
\begin{note}
345+
The function \tcode{std::uncaught_exceptions}\iref{uncaught.exceptions}
346+
returns the number of uncaught exceptions in the current thread.
347+
\end{note}
348+
330349
\pnum
331350
\indextext{exception handling!terminate called@\tcode{terminate} called}%
332351
\indextext{\idxcode{terminate}!called}%
333352
If the exception handling mechanism
334-
handling an uncaught exception\iref{except.uncaught}
353+
handling an uncaught exception
335354
directly invokes a function that exits via an
336355
exception, the function \tcode{std::terminate} is invoked\iref{except.terminate}.
337356
\begin{example}
@@ -1007,8 +1026,10 @@
10071026
The function \tcode{std::terminate}\iref{except.terminate}
10081027
is used by the exception
10091028
handling mechanism for coping with errors related to the exception handling
1010-
mechanism itself. The function
1011-
\tcode{std::current_exception()}\iref{propagation} and the class
1029+
mechanism itself.
1030+
The function \tcode{std::uncaught_exceptions}\iref{uncaught.exceptions}
1031+
reports how many exceptions are uncaught in the current thread.
1032+
The function \tcode{std::current_exception}\iref{propagation} and the class
10121033
\tcode{std::nested_exception}\iref{except.nested} can be used by a program to
10131034
capture the currently handled exception.
10141035

@@ -1132,21 +1153,4 @@
11321153
prematurely based on a determination that the unwind process
11331154
will eventually cause an invocation of the function
11341155
\tcode{std::terminate}.
1135-
1136-
\rSec2[except.uncaught]{The \tcode{std::uncaught_exceptions} function}%
1137-
\indexlibraryglobal{uncaught_exceptions}
1138-
1139-
\pnum
1140-
An exception is considered uncaught
1141-
after completing the initialization of the exception object\iref{except.throw}
1142-
until completing the activation of a handler for the exception\iref{except.handle}.
1143-
\begin{note}
1144-
As a consequence, an exception is considered uncaught
1145-
during any stack unwinding resulting from it being thrown.
1146-
\end{note}
1147-
If an exception is rethrown\iref{expr.throw,propagation},
1148-
it is considered uncaught from the point of rethrow
1149-
until the rethrown exception is caught.
1150-
The function \tcode{std::uncaught_exceptions}\iref{uncaught.exceptions}
1151-
returns the number of uncaught exceptions in the current thread.%
11521156
\indextext{exception handling|)}

source/support.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3849,7 +3849,7 @@
38493849
\begin{itemdescr}
38503850
\pnum
38513851
\returns
3852-
The number of uncaught exceptions\iref{except.uncaught}.
3852+
The number of uncaught exceptions\iref{except.throw} in the current thread.
38533853

38543854
\pnum
38553855
\remarks

source/xrefdelta.tex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@
9090
\movedxref{stoptoken.cons}{stopsource}
9191
\movedxref{stoptoken.nonmembers}{stopsource}
9292

93+
% https://github.com/cplusplus/draft/pull/7276
94+
\movedxref{except.uncaught}{except.throw}
95+
9396
%%% Deprecated features.
9497
%%% Example:
9598
%

0 commit comments

Comments
 (0)