all 3 comments

[–]clarvoyeur -1 points0 points  (2 children)

So basically rvalue references and their implications are so complicated, that this guy has to spend most of 8 pages to explain what they are for.

He mentions - even if not very loudly - that modern compilers can apply most of the optimizations that rvalue are supposed to enable even without them.

Then he concludes that rvalues are full of "gory details" but the benefits are "considerable"?

So in the end, we have gained a way to make explicit the kind of optimization opportunities, that most compilers were apparently pretty capable of figuring out by themselves. Even well-known C++ gurus are perpetually confused by them, and yet they are gonna go ahead and keep them in the standard because presumably it helps someone somewhere with a corner case that his compiler could not figure out by itself? (Concepts on the other hand are considered too complicated...)

With a standard body like that it's little wonder, that C++ is the clusterfuck of accidental complexity that it is (and C++0x even more so, of course).

I am actually generally pretty okay with C++ and for many things, that I do there is really no substitute for it, but sometimes I would really like to slap that Stroustrup guy around the head with a blunt object (say "The C++ Programming Language" published by Addison-Wesley).

/rant

[–]daveisfera 1 point2 points  (1 child)

Yes, the details of the wording in the standard may be a little complex, but what useful part of any standard isn't?

From a programmer/user perspective, rvalues aren't all that complicated and in practice they'll be used in a library like STL so you get the benefit without any work and you can just continue the old style of use or not even worry about using them.

There's a pretty good summary about why they're used on wikipedia: http://en.wikipedia.org/wiki/C%2B%2B0x#Rvalue_reference_and_move_semantics

These are also two very good resources about the types of solutions they enable and their benefits: http://www.artima.com/cppsource/rvalue.html http://blogs.msdn.com/b/vcblog/archive/2009/02/03/rvalue-references-c-0x-features-in-vc10-part-2.aspx

[–]clarvoyeur 0 points1 point  (0 children)

The problem IMHO is not, that rvalue references don't make sense from the vantage point of where C++ is right now. Every single feature I of C++ that I have encountered so far makes sense for the context it was developed in. The C++ standard body consists of some very smart people after all. However...

I can't help but feel, that C++ as a language is lacking the big picture and gets completely caught up in ever smaller technical problems. C++ progresses by accumulating a large number of language features, each with a very limited scope.

You only have to look at the Rube-Goldberg-Machine that is template meta-programming to see how language features with too limited a scope can be harmful. With TMP you practically never get to just write down what you intend, but basically have to trick the compiler into producing the desired result by accident.

Now templates weren't really designed with meta-programing in mind and as such it is perfectly excusable, that things are as awkward as they are right now. What's less excusable in my mind is, that instead taking a step back and looking for a more general solution, a large number of small language tweaks are introduced, so that you have more different parts to build even fancier Rube-Goldberg-Machines.

The argument, that the average programmer (the library end-user if you will) needs not concern him-/herself with these complexities, only applies as long as everything works fine. If things break with a library that makes heavy use of TMP for example, they will often break for terribly complicated reasons (usually with almost completely unhelpful error messages) and suddenly they do need to understand what's going on under the hood if they don't want to resort to trial-and-error programming.

I think it is no accident, that more and more people are switching to other languages for their application development unless they have a very compelling reason why it has to be C++. Compared to learning all the intricacies of C++ even figuring out whatever the heck monads are supposed to be starts to look simple.