mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
Updated R.3 to refer to #Rf-out
This commit is contained in:
@@ -6572,7 +6572,7 @@ Returning a (raw) pointer imposes a life-time management uncertainty on the call
|
|||||||
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" (see ["out" return values](#Rf-out)):
|
||||||
|
|
||||||
Gadget make_gadget(int n)
|
Gadget make_gadget(int n)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user