C++ Logo

std-proposals

Advanced search

Re: Stacktrace from exception

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Thu, 29 Apr 2021 15:16:23 +0300
On 4/29/21 2:38 PM, Edward Catmur wrote:
> On Thu, 29 Apr 2021 at 12:22, Andrey Semashev via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> wrote:
>
> On 4/29/21 1:13 PM, Edward Catmur wrote:
> > If you're using exceptions for control flow the compiler will be
> able to
> > see the whole of the program accessible from the catch block.
>
> I don't see how.
>
> Presumably your catch block is empty in that case?

I'm sorry, you completely lost me. How a catch block is empty and yet it
contains std::current_exception_stacktrace call and supposedly processes
(logs?) a stacktrace?

My point is that the throw site, the catch site and
std::current_exception_stacktrace call site can all be in different TUs,
and the compiler cannot see all of them at once. So
std::current_exception_stacktrace call cannot be an indication that a
stacktrace needs to be collected at the throw site.

Received on 2021-04-29 07:16:29