The title of this book describes what I consider to be the main problem with both C++ and C: the languages give you so much flexibility that, unless you're willing and able to discipline yourself, you can end up with a large body of unmaintainable gobblygook masquerading as a computer program. You can do virtually anything with these languages, even when you don't want to.
Allen I. Holub
C++11 is already here. I'm not going to make another overview of all the good new things in it. Actually, I don't know much about those good new things. What I'm going to make - is an overview of why these good new things don't matter much (and why I am not too ashamed of not knowing much about them). There are few reasons.
First of all, you are not going to find a 100% standard-conforming C++ compiler. Even for a previous standard. If you open MSDN on almost any interesting C++ related topic, you'll see a "Microsoft Specific" section that could be larger than the rest of the page. Searching for unresolved issues containing "C++" in GCC Bugzilla finds 1055 issues at the time I write this words. Only Comeau is said to support everything, but who is using Comeau??
Most of my professional experience is from writing C++ code for a limited devices - game consoles. The story of C++ support on consoles is even more gloomy. If you open the documentation for CodeWarrior for DS, you'll see lots of information on what C++ features are implemented, and on non-standard C++ extensions. When we complained on official DS debugger having problems with understanding C++ code, we were answered, that C++ support in the debugger is experimental. I mean, it was not a question, what C++ standard it support, it was a question if C++ is supported at all!
So why there's so many C++ compilers, and no compliant one? The reason to it is that C++ language is too damn complicated. Come on, have you read all the 1300+ pages of the C++ standard? There's so many corner cases, that when you do write C++ code you are to keep it as simple as reasonable. This way you may hope that switching to another compiler would require rewriting just few pieces of your code (still having illusions of cross-platform compatibility??).
Another reason for keeping the code simple, is because otherwise you are risking to get a gunshot wound.
C makes it easy to shoot yourself in the foot;
C++ makes it harder, but when you do it blows your whole leg off.
Everyone knows that debugging is twice as hard as writing a program in the first place.
So if you're as clever as you can be when you write it, how will you ever debug it?
Writing code is about readability. The more complicated your code gets, the more time will be spent reading it. With C++ you have to restrict yourself from writing a too clever code even without C++11. "Enough Rope to Shoot Yourself in the Foot" was published in 1995. Think you are out of rope already and you need new standard? Now imagine for a second that you have to debug some code with move semantics involved. Do you feel happy?
Now, to summarize things, you will not be using C++11 features because they will not be supported by your compiler (just read "Why We Can’t Afford Export", it's written by Herb Sutter!! Or read this.). And when they become supported, you will not be using them because of compatibility and clarity reasons. That is why I think all that C++11 celebration and rapture are overrated. It's more like the standard authors are living in some other, better but imaginary world.
|The C++11 Lands|