mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-18 21:24:41 +03:00
Add note about pointerlike indirections, and remove incorrect destructor note
Closes #2183 Closes #2188
This commit is contained in:
@@ -5096,10 +5096,6 @@ There are two general categories of classes that need a user-defined destructor:
|
|||||||
|
|
||||||
The default destructor does it better, more efficiently, and can't get it wrong.
|
The default destructor does it better, more efficiently, and can't get it wrong.
|
||||||
|
|
||||||
##### Note
|
|
||||||
|
|
||||||
If the default destructor is needed, but its generation has been suppressed (e.g., by defining a move constructor), use `=default`.
|
|
||||||
|
|
||||||
##### Enforcement
|
##### Enforcement
|
||||||
|
|
||||||
Look for likely "implicit resources", such as pointers and references. Look for classes with destructors even though all their data members have destructors.
|
Look for likely "implicit resources", such as pointers and references. Look for classes with destructors even though all their data members have destructors.
|
||||||
@@ -12682,6 +12678,10 @@ wrong results, or memory corruption.
|
|||||||
|
|
||||||
##### Note
|
##### Note
|
||||||
|
|
||||||
|
By pointer here we mean any indirection to an object, including equivalently an iterator or view.
|
||||||
|
|
||||||
|
##### Note
|
||||||
|
|
||||||
This rule is an obvious and well-known language rule, but can be hard to follow.
|
This rule is an obvious and well-known language rule, but can be hard to follow.
|
||||||
It takes good coding style, library support, and static analysis to eliminate violations without major overhead.
|
It takes good coding style, library support, and static analysis to eliminate violations without major overhead.
|
||||||
This is a major part of the discussion of [C++'s model for type- and resource-safety](#Stroustrup15).
|
This is a major part of the discussion of [C++'s model for type- and resource-safety](#Stroustrup15).
|
||||||
|
|||||||
Reference in New Issue
Block a user