mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Mismatching and missing quotes.
And other problems fixed.
This commit is contained in:
parent
4c55ed4662
commit
ff623adc6b
|
@ -6428,7 +6428,7 @@ Returning a (raw) pointer imposes a life-time management burden on the caller; t
|
||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
|
|
||||||
In addition to suffering from the problem from [leak](#???), this adds a spurious allocation and deallocation operation, and is needlessly verbose. If Gadget is cheap to move out of a function (i.e., is small or has an efficient move operation), just return it "by value:'
|
In addition to suffering from the problem from [leak](#???), this adds a spurious allocation and deallocation operation, and is needlessly verbose. If Gadget is cheap to move out of a function (i.e., is small or has an efficient move operation), just return it "by value":
|
||||||
|
|
||||||
Gadget make_gadget(int n)
|
Gadget make_gadget(int n)
|
||||||
{
|
{
|
||||||
|
@ -6802,7 +6802,7 @@ be able to destroy a cyclic structure.
|
||||||
|
|
||||||
??? (HS: A lot of people say "to break cycles", while I think "temporary shared ownership" is more to the point.)
|
??? (HS: A lot of people say "to break cycles", while I think "temporary shared ownership" is more to the point.)
|
||||||
???(BS: breaking cycles is what you must do; temporarily sharing ownership is how you do it.
|
???(BS: breaking cycles is what you must do; temporarily sharing ownership is how you do it.
|
||||||
You could "temporarily share ownership simply by using another `stared_ptr`.)
|
You could "temporarily share ownership" simply by using another `stared_ptr`.)
|
||||||
|
|
||||||
##### Enforcement
|
##### Enforcement
|
||||||
|
|
||||||
|
@ -6852,7 +6852,7 @@ A function that does not manipulate lifetime should take raw pointers or referen
|
||||||
|
|
||||||
##### Enforcement
|
##### Enforcement
|
||||||
|
|
||||||
* (Simple) Warn if a function takes a parameter of a type that is a `Unique_ptr` or `Shared_ptr` and the function only calls any of: `operator*`, `operator->` or `get()`).
|
* (Simple) Warn if a function takes a parameter of a type that is a `Unique_ptr` or `Shared_ptr` and the function only calls any of: `operator*`, `operator->` or `get()`.
|
||||||
Suggest using a `T*` or `T&` instead.
|
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`
|
### <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