cplusplus / cplusplus/draft

[C++29][except] Dissolve the exceptions clause into the rest of the document

Open
#7,317 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

P3-Other
Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

Exceptions are a control flow, just like if, while, and goto. They belong somewhere in [stmt], with the exception (no pun) of [except.throw] as a throw_expression is literally an expression, so move [except.throw] to follow [expr.delete] as a unary operator.

Exception specifications are nothing to do with control flow, and are entirely a function specifier that feeds the noexcept operator, so belong somewhere in [dcl]. See #7308.

The specification for the uncaught_exceptions function is the wrong place to augment the rules for when an exception is active. They belong in [except.handle] around p9/p10 that define what it means for an exception to be active, leaving the library wording to define the semantics of this function without duplication. See #7276.

The terminate function is now used for more than just failures of the exception handling machinery. Its description should be updated accordingly. See #7281.

Once the specification of terminate has been updated, it is no longer specifically an exception feature, and should be relocated to the end of [basic.start] Start and termination. That completes dissolving this clause into the rest of the standard.

Jens noted that exceptions really did belong in [stmt] from the start, but they were still an experimental feature as C++ was being standardized in 1997, unlike most the rest of that clause, so were conservatively given their own top level clause in case of complications. We are not past time to put them back where they belong.

Note that it would be good to land #7276 for C++26, as that will complete moving all the specification of handling an activ exception into a single place. While it would be nice to also land #7281 and resolve its fix-me, that is less impactful.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the [except], [stmt], [expr.delete], [dcl], and [basic.start] clauses in the draft, then review the related work in #7308, #7276, and #7281. Done means exception wording is redistributed to the specified clauses, active-exception rules and terminate wording are updated, and the former top-level exception clause is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, tex
Domain
documentation
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.