Stroustrup Reveals What's New In C++ 11
snydeq writes "Bjarne Stroustrup discusses the latest version of C++, which, although not a major overhaul, offers many small upgrades to appeal to different areas of development. From the interview: 'I like the way move semantics will simplify the way we return large data structures from functions and improve the performance of standard-library types, such as string and vector. People in high-performance areas will appreciate the massive increase in the power of constant expressions (constexpr). Users of the standard library (and some GUI libraries) will probably find lambda expressions the most prominent feature. Everybody will use smaller new features, such as auto (deduce a variable's type from its initializer) and the range-for loop, to simplify code.'"
Hey you,
I've written big apps in C++ and can tell you: C++ SUCKS!! It's a piece of shit language with a very crappy garbage collector, a baroque, undecidable syntax, no end of karma, and a community that revels in BDSM programming. With an emphasis on the M.
So there.
The new version of C++ is a decade behind schedule, and consists mostly of marginal features. Memory safety hasn't improved. Concurrency isn't really supported in the language; all that's really been done is to nail down some of the semantic issues that matter when multiple threads are executing on superscalar processors. There are lots of new features only useful to people writing templates, which are a terrible programming environment. "auto" is useful (I wanted to call it "let", but there was objection to a new short keyword), mainly because the type definitions of iterators are so bulky. The main purpose of "auto" is to allow for (auto p = arr.begin(); p != arr.end(); p++) {... } without worrying about the type of arr. As long as arr is an iterable collection, that should work.
This still doesn't prevent buffer overflows, but at least the most concise way to iterate over an array is reasonably safe. (Not totally safe; modifying a collection over which you are iterating breaks the memory model.) Over the next few decades, the number of buffer overflow bugs might decrease slightly.
It's an improvement, but not one that was worth waiting a decade for.
Time to join the 21st century grandpa. FILE* leaks. memcpy doesn't call overloaded assignment operators. printf is not typesafe. void* is an abomination that should need no explanation. Custom string and array classes are unoptimized at best and buggy half finished crap at worst.
C++ started out as a small set of focused, simple enhancements to C. It didn't pretend to be a great new language, just provide workarounds for some of C's most annoying problems. It was nice and I started using back then, about 25 years ago.
Now C++ has turned into a disaster, a bloated pig of a language, with features added left and right, incoherently, in order to try to catch up with other languages. But if you want speed, you still have to get rid of all the layers of abstraction that C++ offers and write it in plain C (or a C-like subset). And C++'s attempts at module systems, separate compilation, and garbage collection are still much worse than pretty much any other language.