mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
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 <N.Dekker@lumc.nl> Co-authored-by: Herb Sutter <herb.sutter@gmail.com> Co-authored-by: Niels Dekker <N.Dekker@lumc.nl> Co-authored-by: Herb Sutter <herb.sutter@gmail.com>
This commit is contained in:
@@ -4993,12 +4993,19 @@ There is a lot of code that is non-specific about ownership.
|
|||||||
|
|
||||||
##### Example
|
##### 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
|
##### Note
|
||||||
|
|
||||||
If the `T*` or `T&` is owning, mark it `owning`. If the `T*` is not owning, consider marking it `ptr`.
|
Ownership should be clear in new code (and refactored legacy code) according to [R.20](#Rr-owner) for owned
|
||||||
This will aid documentation and analysis.
|
pointers and [R.3](#Rr-ptr) for non-owned pointers. References should never own [R.4](#Rr-ref).
|
||||||
|
|
||||||
##### Enforcement
|
##### Enforcement
|
||||||
|
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ Lakos
|
|||||||
Lakos96
|
Lakos96
|
||||||
Lavavej
|
Lavavej
|
||||||
LCSD05
|
LCSD05
|
||||||
|
legacy_class
|
||||||
lifecycle
|
lifecycle
|
||||||
*life-time
|
*life-time
|
||||||
linearization
|
linearization
|
||||||
@@ -301,6 +302,8 @@ lvalues
|
|||||||
m1
|
m1
|
||||||
m2
|
m2
|
||||||
m3
|
m3
|
||||||
|
m_owning;
|
||||||
|
m_observer;
|
||||||
macros2
|
macros2
|
||||||
malloc
|
malloc
|
||||||
mallocfree
|
mallocfree
|
||||||
|
|||||||
Reference in New Issue
Block a user