From 42c4cc6a754a11120004820c8d292e8c7581b1bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Szeder?= Date: Wed, 13 Jul 2022 18:05:36 +0200 Subject: [PATCH] E.19: clarify that `finally` is from the GSL (#1936) When I stumbled upon E.19 "Use a `final_action` object to express cleanup if no suitable resource handle is available" I was hopeful that this `final_action`/`finally()` thing is from the STL, but, alas, it isn't. Make it clear that `finally` is a GSL construct. --- CppCoreGuidelines.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index d5cd868..eaab74d 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -16216,14 +16216,14 @@ Better: ##### Reason -`finally` is less verbose and harder to get wrong than `try`/`catch`. +`finally` from the [GSL](#S-gsl) is less verbose and harder to get wrong than `try`/`catch`. ##### Example void f(int n) { void* p = malloc(n); - auto _ = finally([p] { free(p); }); + auto _ = gsl::finally([p] { free(p); }); // ... }