diff options
author | Geoff Liu <hi@geoffliu.me> | 2015-09-02 00:46:30 -0600 |
---|---|---|
committer | Geoff Liu <hi@geoffliu.me> | 2015-09-02 00:46:30 -0600 |
commit | 85f6ba0b57b9d894c694df66449b1e1c555c625b (patch) | |
tree | 70e908b87a9ae845e9d1599dbca3651981b17a28 /c++.html.markdown | |
parent | 4a2af140e47d56f0a1baa73317888f3bd5e16088 (diff) |
A note about RVO
Diffstat (limited to 'c++.html.markdown')
-rw-r--r-- | c++.html.markdown | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/c++.html.markdown b/c++.html.markdown index fa80e6d5..26dfe111 100644 --- a/c++.html.markdown +++ b/c++.html.markdown @@ -262,7 +262,10 @@ string retVal = tempObjectFun(); // - the returned object is destroyed // The returned object is called a temporary object. Temporary objects are // created whenever a function returns an object, and they are destroyed at the -// end of the evaluation of the enclosing expression. So in this code: +// end of the evaluation of the enclosing expression (Well, this is what the +// standard says, but compilers are allowed to change this behavior. Look up +// "return value optimization" if you're into this kind of details). So in this +// code: foo(bar(tempObjectFun())) // assuming `foo` and `bar` exist, the object returned from `tempObjectFun` is |