Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions CppCoreGuidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions scripts/hunspell/isocpp.dic
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ Lakos
Lakos96
Lavavej
LCSD05
legacy_class
lifecycle
*life-time
linearization
Expand All @@ -301,6 +302,8 @@ lvalues
m1
m2
m3
m_owning;
m_observer;
macros2
malloc
mallocfree
Expand Down