From ed78161416c9c8f63002ca123822694c47fe343d Mon Sep 17 00:00:00 2001 From: Vladimir Gamalian Date: Tue, 22 Sep 2015 10:06:44 +0700 Subject: [PATCH] Fix typo --- CppCoreGuidelines.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index e5b15cb..5291e6d 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -8411,7 +8411,7 @@ The `noexcept` here states that I am not willing or able to handle the situation void leak(int x) // don't: may leak { auto p = new int{7}; - int (x<0) throw Get_me_out_of_here{}; // may leak *p + if (x<0) throw Get_me_out_of_here{}; // may leak *p // ... delete p; // we may never get here } @@ -8421,7 +8421,7 @@ One way of avoiding such problems is to use resource handles consistently: void no_leak(int x) { auto p = make_unique(7); - int (x<0) throw Get_me_out_of_here{}; // will delete *p if necessary + if (x<0) throw Get_me_out_of_here{}; // will delete *p if necessary // ... // no need for delete p }