C++0x: Too little, too late

Posted by Martin Vilcans on 13 January 2006

Bjarne Stroustrup, the creator of C++ has written A Brief Look at C++0x, where he shows a few features that will likely become part of the new C++ standard. My first impression is the same as I had with every release of Java leading up to version 1.5: "Too little, too late".

The ISO C++ committee are still years from freezing the new language spec, and judging by the rate new C++ features have been included in some compilers historically, I guess we'll have to wait until 2010 before the new features are supported well enough for us to start relying on them.

Stroustrup shortly mentions garbage collection as one of the features, and this is the most important change in my opinion. Sure, garbage collection may cost some CPU time, and RAM in particular, but it simplifies programming so much that it is worth it. Not having to worry about pointer ownership is a great relief. If it's possible to specify which classes should be garbage collection, there is also the possibility to optimize classes by changing how their memory is handled.

Apart from garbage collection, there are few features that make me go "wow!", and even garbage collection is nothing new so I didn't really go "wow!" because of that either. It has been available as third party products for years. It's good that it's becoming part of the language spec itself though. The new features mostly seem to be about cleaning up the uglier parts of the language, for example compile errors related to templates. This is good idea, but it's not very revolutionary. Many changes seem to be additions to the standard library, where we already have a de facto standard library in Boost.

Where are the cool new features, like good multiprocessor support (and I'm not talking about just synchronization, like in Java), removing the declaration/definition distinction (which is an unnecessary violation of the Don't Repeat Yourself principle), lambda functions (would be useful for the STL algorithms), built-in unit testing and design by contract constructs (like D has), reflection (like in Java), aspect oriented programming, alternatives to situations where we still have to use the preprocessor and other features that I can't even think about?

All of the above features are available in other languages, though I don't know of one language that implements them all. As far as I can see it would be possible to implement them in C++ while keeping its "efficient but flexible" profile. The problem Stroustrup mentions is that the ISO C++ committee does not have time to work on the specification as much as they would like, and I guess this is the problem with a language designed by a committee.

When I discovered the D language, I went "wow!". That language has all the good features of C++, some of the features in my wishlist above, but unfortunately just a tiny fraction of the user base. I wrote about D in this post,so I won't repeat it.

This may sound like I'm bashing C++, but in spite of its faults, it's still my favourite language for speed-critical software. There really is no competition. Scripting languages are too slow and virtual machine based languages (Java and Microsoft's CLR languages) require a too heavy runtime environment and are hard to interface to native code. C++ is close to the metal and very powerful but still has relatively high-level constructs such as classes and templates. There really isn't any popular language that competes with C++'s position. I'm hoping that D will become a real competitor. Sun got down to improving Java at last when Microsoft announced C#, so competition is a good thing.

/me hopes to be proven wrong, and that C++0x will make me go "wow!".

Previous: Random links
Next: Les Justes

Comments disabled on this post.