C++ Logo


Advanced search

Re: [std-proposals] Execute statement when leaving scope

From: Lénárd Szolnoki <cpp_at_[hidden]>
Date: Mon, 12 Dec 2022 20:06:45 +0000

On 12 December 2022 09:58:22 GMT, Ville Voutilainen via Std-Proposals <std-proposals_at_[hidden]> wrote:
>That's because it's in gcc 13,
> - Support for the <experimental/scope> header from v3 of the Library
> Fundamentals Technical Specification.

Interesting. I'm not very impressed with the generated code for scope_success:


I believe that f1 and f2 are equivalent.

I suspect that scope_fail has similarly bad codegen for now.

It's possibly a QoI issue, and with some compiler magic calls to std::uncaught_exceptions() could be elided for the common cases. That is when scope_success has automatic storage duration and not moved.


Received on 2022-12-12 20:06:52