You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void fct2(const int& x); // bad: overhead on access in fct2()
2317
+
void f4(const int& x); // bad: overhead on access in f4()
2318
2318
2319
2319
For advanced uses (only), where you really need to optimize for rvalues passed to "input-only" parameters:
2320
2320
@@ -7259,7 +7259,7 @@ The members of a scoped object are themselves scoped and the scoped object's con
7259
7259
7260
7260
The following example is inefficient (because it has unnecessary allocation and deallocation), vulnerable to exception throws and returns in the `...` part (leading to leaks), and verbose:
7261
7261
7262
-
void some_function(int n)
7262
+
void f(int n)
7263
7263
{
7264
7264
auto p = new Gadget{n};
7265
7265
// ...
@@ -7268,7 +7268,7 @@ The following example is inefficient (because it has unnecessary allocation and
7268
7268
7269
7269
Instead, use a local variable:
7270
7270
7271
-
void some_function(int n)
7271
+
void f(int n)
7272
7272
{
7273
7273
Gadget g{n};
7274
7274
// ...
@@ -10971,7 +10971,7 @@ In such cases, "crashing" is simply leaving error handling to the next level of
10971
10971
10972
10972
##### Example
10973
10973
10974
-
void do_something(int n)
10974
+
void f(int n)
10975
10975
{
10976
10976
// ...
10977
10977
p = static_cast<X*>(malloc(n,X));
@@ -10981,7 +10981,7 @@ In such cases, "crashing" is simply leaving error handling to the next level of
10981
10981
10982
10982
Most systems cannot handle memory exhaustion gracefully anyway. This is roughly equivalent to
10983
10983
10984
-
void do_something(Int n)
10984
+
void f(Int n)
10985
10985
{
10986
10986
// ...
10987
10987
p = new X[n]; // throw if memory is exhausted (by default, terminate)
0 commit comments