[libcxx-commits] [PATCH] D112319: [NFC][libcxx] Clean up std::__call_once

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 13 15:53:22 PST 2021


Quuxplusone added a comment.

FWIW, when I see the name `__scope_guard` I assume it'll work like a `finally` clause, running its code unconditionally on scope exit. (Like https://quuxplusone.github.io/blog/2018/08/11/the-auto-macro/ . :))
But what we want here is a `catch` clause, running its code only if an exception actually //is// thrown. No matter what you name the scope-guard, it's going to be a speed bump for the reader, whereas `try { func(arg); } catch(...) { some code; throw; }` can be understood instantly.
Perhaps Louis's idea, but with the scope-guard class type named `struct __catch_and_rethrow_logic`? It needs //something// to catch the reader's attention that it's specifically the catch path, not a general-purpose scope guard.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112319/new/

https://reviews.llvm.org/D112319



More information about the libcxx-commits mailing list