mojo and return value optimization

P

Peng Yu

Hi,

On http://www.ddj.com/database/184403855, it says

"...the goal is portable efficiency — 100% elimination of unnecessary
copies, without dependence on one particular RVO implementation."

But if there is RVO in the compiler that I'm using (I think GCC has
it, right?) and I do not care about other compiler, do I still need
the technique mentioned on that webpage?

Thanks,
Peng
 
P

Peng Yu

That depends on whether your compiler can actually apply
RVO in your specific case and how much you depend on that
being the case.

Do you have a summary on how many cases could be for RVO? If I know
all the cases, then I can make a sound decision on what I should for
each case?

Do you know how different many commonly used compilers are in the
aspect of RVO?

Thanks,
Peng
 
T

Triple-DES

Hi,

Onhttp://www.ddj.com/database/184403855, it says

"...the goal is portable efficiency — 100% elimination of unnecessary
copies, without dependence on one particular RVO implementation."

But if there is RVO in the compiler that I'm using (I think GCC has
it, right?) and I do not care about other compiler, do I still need
the technique mentioned on that webpage?

If you are using gcc 4.3, and do not care about portability, you can
use rvalue references to implement move construction and move
assignment. It's the same principle, but with direct language
support.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top