Skip to content

Commit cbf4554

Browse files
bgloyerN-Dekkerhsutter
authored
Clean up and add example for C.32 - raw pointers (#1909)
* Update CppCoreGuidelines.md * Update CppCoreGuidelines.md * Update isocpp.dic * use snake casing * sake case naming * C 32 comments (#3) * F.16 ("in" parameters): Move Matrix example to F.20 (return values) (#1922) The `Matrix` example and the notes about assignment appear off-topic in rule F.16, as F.16 is specifically about "in" parameters. With help from Sergey Zubkov. * SL.io.50 (Avoid `endl`): Mention string streams (#1920) Explicitly mentioned string streams as `endl` insertions into string streams do actually occur in the wild. With help from Sergey Zubkov. * Extended E.16 to include copy ctor for exception type, closes #1921 * Fix GitHub Actions build warnings, Marker style should be `*` (#1925) * restored reference * Added references to note Co-authored-by: Niels Dekker <[email protected]> Co-authored-by: Herb Sutter <[email protected]> Co-authored-by: Niels Dekker <[email protected]> Co-authored-by: Herb Sutter <[email protected]>
1 parent f2e9b5c commit cbf4554

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

CppCoreGuidelines.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4993,12 +4993,19 @@ There is a lot of code that is non-specific about ownership.
49934993

49944994
##### Example
49954995

4996-
???
4996+
class legacy_class
4997+
{
4998+
foo* m_owning;
4999+
bar* m_observer;
5000+
}
5001+
5002+
The only way to determine ownership may be to dig through the code to look for
5003+
allocations. If a pointer or reference is owning, document it as owning.
49975004

49985005
##### Note
49995006

5000-
If the `T*` or `T&` is owning, mark it `owning`. If the `T*` is not owning, consider marking it `ptr`.
5001-
This will aid documentation and analysis.
5007+
Ownership should be clear in new code (and refactored legacy code) according to [R.20](#Rr-owner) for owned
5008+
pointers and [R.3](#Rr-ptr) for non-owned pointers. References should never own [R.4](#Rr-ref).
50025009

50035010
##### Enforcement
50045011

scripts/hunspell/isocpp.dic

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ Lakos
286286
Lakos96
287287
Lavavej
288288
LCSD05
289+
legacy_class
289290
lifecycle
290291
*life-time
291292
linearization
@@ -301,6 +302,8 @@ lvalues
301302
m1
302303
m2
303304
m3
305+
m_owning;
306+
m_observer;
304307
macros2
305308
malloc
306309
mallocfree

0 commit comments

Comments
 (0)