C++ Logo

std-proposals

Advanced search

Re: [std-proposals] fine-control exception/error/UB handling on function boundary

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sat, 29 Aug 2026 10:21:13 -0300
On Friday, 28 August 2026 13:40:16 Brasilia Standard Time Tiago Freire via
Std-Proposals wrote:
> > Neither g nor h will ever see the exception if f throws. Neither g nor h
> > have the opportunity to handle the exception. Neither g nor h will even
> > be called.
> That just not true at all. Code must be generated for g and h to be able to
> unwind, you just don't write it yourself. If f throws, code must pickup the
> context g and h and destroy objects that g and h have specifically created.
> There's a whole lot of stuff that happens when you throw, just none of it
> is transparent.

Repeating what Rainer said word-for-word, because it's correct: if f throws,
then neither g() nor h() will have been invoked and therefore they are not in
the context to be unwound in the first place.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-08-29 13:21:28