mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
c/assigned to/modified in F.7 and R.30
This commit is contained in:
parent
94b567d2b8
commit
4748906ec1
|
@ -2230,7 +2230,7 @@ We can catch dangling pointers statically, so we don't need to rely on resource
|
|||
|
||||
##### Enforcement
|
||||
|
||||
* Flag a parameter of a smart pointer type (a type that overloads `operator->` or `operator*`) that is copyable but never copied/moved from in the function body or else movable but never moved from in the function body or by being a by-value parameter, and that is never assigned to, and that is not passed along to another function that could do so. That means the ownership semantics are not used.
|
||||
* Flag a parameter of a smart pointer type (a type that overloads `operator->` or `operator*`) that is copyable but never copied/moved from in the function body or else movable but never moved from in the function body or by being a by-value parameter, and that is never modified, and that is not passed along to another function that could do so. That means the ownership semantics are not used.
|
||||
|
||||
### <a name="Rf-pure"></a>F.8: Prefer pure functions
|
||||
|
||||
|
@ -7315,7 +7315,7 @@ A function that does not manipulate lifetime should take raw pointers or referen
|
|||
##### Enforcement
|
||||
|
||||
* (Simple) Warn if a function takes a parameter of a smart pointer type (that overloads `operator->` or `operator*`) `unique_ptr` or `shared_ptr` and the function only calls any of: `operator*`, `operator->` or `get()`.
|
||||
* Flag a parameter of a smart pointer type (a type that overloads `operator->` or `operator*`) that is copyable but never copied/moved from in the function body or else movable but never moved from in the function body or by being a by-value parameter, and that is never assigned to, and that is not passed along to another function that could do so. That means the ownership semantics are not used.
|
||||
* Flag a parameter of a smart pointer type (a type that overloads `operator->` or `operator*`) that is copyable but never copied/moved from in the function body or else movable but never moved from in the function body or by being a by-value parameter, and that is never modified, and that is not passed along to another function that could do so. That means the ownership semantics are not used.
|
||||
Suggest using a `T*` or `T&` instead.
|
||||
|
||||
### <a name="Rr-smart"></a>R.31: If you have non-`std` smart pointers, follow the basic pattern from `std`
|
||||
|
|
Loading…
Reference in New Issue
Block a user