diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index aedefc4..53c3156 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -14139,10 +14139,16 @@ To prevent slicing. // ... } -Instead, use: +Instead, use a reference: catch (exception& e) { /* ... */ } +of - typically better stil - a `const` reference: + + catch (const exception& e) { /* ... */ } + +Most handlers do not modify their exception and in general we [recommend use of `const`](#Res-const). + ##### Enforcement Flag by-value exceptions if their types are part of a hierarchy (could require whole-program analysis to be perfect).