20 Jul 2010 redi   » (Master)

Also, the RVO doesn't rely on inlining, and there's no default construction or assignment operator in that example, MyObj x = ... is a constructor call not an assignment.

Sure RVO is a hack, but it's a safe and useful one (in many more situations than apenwarr's map case) so why do you care? Any why would anyone ever ever use C++ without an optimising compiler?! If you don't care enough about performance to use a decent compiler then why are you using C++ in the first place?

The only downside to the RVO (apart from the fact that the wikipedia article is incomplete and doesn't distinguish RVO and NRVO) is if you're relying on side effects of copy constructors, but that usually only happens in toy code people write to try and understand C++ rules.

My only other quibble is with the statement that you always know 'this' when you create a pointer-to-member-function. If that's how you use PMFs no wonder you don't find them useful ;)

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!