RVO (let the compiler copy)
Henrik Mannerström
henrik.mannerstrom@gmail.com
Thu Dec 19 10:50:00 GMT 2013
On 12/19/2013 12:41 PM, Marc Glisse wrote:
> On Thu, 19 Dec 2013, Henrik Mannerström wrote:
>
>> This question came up on SO (
>> http://stackoverflow.com/questions/7320520/optimizing-the-number-of-constructor-calls)
>>
>> and I was baffled since it went against the mantra "let the compiler do
>> the copying". Do you have an idea of what is going on? Why is the
>> commented version of operator+ worse?
>
> See:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57176
>
Thank you!
I was completely blinded by "pass by value" propaganda
(http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/). Now I
won't be so naive.
More information about the Gcc-help
mailing list