C++ Logo

std-proposals

Advanced search

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

From: Jonathan Grant <jgrantonline_at_[hidden]>
Date: Sat, 29 Aug 2026 01:13:28 +0100
On 28/08/2026 11:08, Sebastian Wittmeier via Std-Proposals wrote:
> h(g(f()))
>
>
>
> One important philosophy of exceptions is that code in-between - like the function g - does not have to care, what kind of exceptions are thrown by f, as long as h handles it.
>
> You could argue that the code within g does not have to care, but at compile-time the function-signature (or some other metadata of the function) should show it.

I'd find it useful there was some advanced static analysis as well as function-signature documentation (to check the they match), and also to verify at compile-time.

BTW, I tried using compile_assert() to validate known exceptions were handled at compile-time, but it couldn't
Regards
Jonathan
>
> You can also say that is a bad philosophy, if you think so.
>
>
>
>
> -----Ursprüngliche Nachricht-----
> *Von:* Tiago Freire via Std-Proposals <std-proposals_at_[hidden]>
> *Gesendet:* Fr 28.08.2026 10:39
> *Betreff:* Re: [std-proposals] fine-control exception/error/UB handling on function boundary
> *An:* std-proposals_at_[hidden];
> *CC:* Tiago Freire <tmiguelf_at_[hidden]>; Zamfir Yonchev <zamfir.yonchev_at_[hidden]>; std-proposals_at_[hidden];
> Well but why?
> Because there are generally 2 camps.
> 1. People who don't use exceptions because they are fundamentally broken.
> 2. People who use exceptions because they don't care.
>
> There is however a minority third camp.
> I don't like exceptions, but am forced to use them to work, because you don't work by yourself and codebases exists before I worked there.
> And I would kill to be able to specify a list of possible exceptions at the interference level to be able to validate the code is exception safe.
>
> I care if my code is safe, but we are in a minority that thinks there is a problem that needs to be solved, but even if you do exceptions are still a dumpster fire and you would never use it if you could so why bother?
>
>

Received on 2026-08-29 00:13:36