diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index eaab74d..fceee69 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -4993,12 +4993,19 @@ There is a lot of code that is non-specific about ownership. ##### Example - ??? + class legacy_class + { + foo* m_owning; + bar* m_observer; + } + +The only way to determine ownership may be to dig through the code to look for +allocations. If a pointer or reference is owning, document it as owning. ##### Note -If the `T*` or `T&` is owning, mark it `owning`. If the `T*` is not owning, consider marking it `ptr`. -This will aid documentation and analysis. +Ownership should be clear in new code (and refactored legacy code) according to [R.20](#Rr-owner) for owned +pointers and [R.3](#Rr-ptr) for non-owned pointers. References should never own [R.4](#Rr-ref). ##### Enforcement diff --git a/scripts/hunspell/isocpp.dic b/scripts/hunspell/isocpp.dic index e9d90e5..0b3520d 100644 --- a/scripts/hunspell/isocpp.dic +++ b/scripts/hunspell/isocpp.dic @@ -286,6 +286,7 @@ Lakos Lakos96 Lavavej LCSD05 +legacy_class lifecycle *life-time linearization @@ -301,6 +302,8 @@ lvalues m1 m2 m3 +m_owning; +m_observer; macros2 malloc mallocfree