C++ Logo

std-proposals

Advanced search

Re: Stacktrace from exception

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Thu, 29 Apr 2021 17:08:53 +0100
On Thu, 29 Apr 2021 at 17:02, Andrey Semashev via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 4/29/21 6:44 PM, Edward Catmur wrote:
> > Quick sketch: the compiler sets a directive at the catch site to request
> > stacktrace,
>
> The compiler would do that based on what?
>

Based on whether it can observe a call to std::current_exception or
std::current_exception_stacktrace, a throw; or a call which may end up
performing any of those.

Yes, yes, I know, you're calling outside the TU to log the exception but
nevertheless find the cost of a 80-byte allocation for a stacktrace
prohibitive. I'm talking about optimizing the exceptions-as-control-flow
usage where the catch block is trivial.

Received on 2021-04-29 11:09:07