C++ Logo

std-proposals

Advanced search

Re: Stacktrace from exception

From: Gašper Ažman <gasper.azman_at_[hidden]>
Date: Thu, 29 Apr 2021 15:56:53 +0100
Right, so exceptions are slow and barely optimized:
https://godbolt.org/z/Y7bxeGT79

but that doesn't mean that program shouldn't be optimized to "mov eax, 5;
ret". The hilarious bit is that the whole exception throw bullshit still
happens, even though control flow analysis determined that "mov eax, 5;
ret" is what the program actually is.

The above is an optimizer bug.

Now, if you make compilers do even more stuff upon an exception throw,
we'll get even further from having reasonable exceptions.

G

On Thu, Apr 29, 2021 at 3:46 PM Edward Catmur via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Thu, 29 Apr 2021 at 13:41, Michael Knaup via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> The point is that something which comes with additional costs - and these
>> seem to be noticeable - should not be added if it only makes sense when
>> you‘ve specific use cases or experience.
>>
>
> I dispute that a small allocation to store a stack trace from throw point
> to handler (8 bytes per frame!) is noticeable next to the current cost of
> exception handling. As for the specific use cases, see above - this is
> something that is frequently requested by users.
>
> Beside this it was already stated multiple times that exceptions are not a
>> tool for handling bugs.
>>
>
> Stating something multiple times doesn't make it a fact. Exceptions are
> used as a tool for handling bugs in real-world code, whether or not you
> approve of that use.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2021-04-29 09:57:08