This is a great comment but I have to disagree with your conclusion.
I love both C and C++, although I don't use them currently. And I can't imagine using them in the future.
The issue here: is there a language that is both low-level enough to write hardware drivers yet high-level enough to abstract away anything that I might want? Close-enough to the metal to bit flip with the best of them yet powerful enough to create and organize large hunks of code?
I think the answer is pretty clearly C++. C is a very close second, but the entire reason from evolving from C to C++ was large development situations.
Would I write a new web-app in C++? Heck no. But software development is a lot bigger than the little corner of the world I have my fingers in, and I can easily see where C++ will be around 20 years from now -- and for new development, not just maintenance. Perhaps even 50 years. So no, not a dead end by any means.
I use C pretty regularly and I can see why I'd need to keep doing so. If I have a problem that needs a custom data structure and any degree of performance, C is how I can keep from wrestling with metadata bloat and garbage collection.
The problems I tend to solve with C are tightly scoped. They tend to admit to libraries, where I can get a foo_t from foo_open(), and then pass it to the foo_bar() functions. They're inherently encapsulated and reusable.
There are things from C++ that I tend to want when I'm writing C. Most importantly, I want vector, and I want a lookup table that returns results in sorted order. So, I backported those things from STLPort to C and never looked back.
There are also things C++ offers me that I think are bad medicine. Classes with access control (and thus graphs of "friend" relationships): not a win over ADT-style C libraries. Smart pointers: not a win over pool allocators (also: knowing how to write a dirt simple allocator is one of the single biggest performance wins I've seen in my career, and C++ makes that hard). Templates: not a win over clear, simple code and discrete components.
My experience with C++ is that it creates drag. There are more decision points in C++ than in C. Do I write a class or do I abstract into a template? Do I need a special type or is this just a container of primitive types? Do I decompose into a hierarchy or do I write straight-line code? Do I use a functor or do I use abstract classes? C is a get-things-done language. C++ is a talk-about-getting-things-done language. And then code-about-getting-things-done.
You've made some awesome points, and I don't disagree that C++ has gotten to the place where you're juggling a freaking lot of stuff around. In straight C you start at point A and code until you reach point B. In C++ if you're not careful you create a map of the known world in Portuguese and then start defining what the word "is" means.
I think back on my C++ production code -- heavy-duty COM stuff, device drivers, embedded software -- and I'd still stick with C++. The trick is that I wouldn't pull in every feature from all over the place.
Modern languages -- especially those that have been around for a long time -- have a lot of cruft. Do you need templates on every project? Most likely not. Do you need the STL? Maybe bits of it but not all by any means. Do you need a freaking class graph with 50 nodes to start sorting integers? No, but bad programmers will make one.
One of the reasons I love C++ is that it makes you understand how to differentiate the bullshit from the solution. This is the flip-side of the exact point you made about having so many options. Got a problem with allocation? Roll an allocator. C++ is the nuclear bomb of power tools, and there are a million ways to cut your arm off.
But for small utilities where you don't touch the metal or interact with some larger, more complex system? C++ isn't the tool.
I completely agree that C++ has some really bad/ouch-don't-do-that things in there. I just think that overall the pluses outweigh the minuses for a certain small set of problems. (and coders)
Keeping the topic to "should I learn C++" and "will there be a C++ in the future"
Want to program the iPhone? Learn Objective-C, a bastardized C++ language
Want to build some shit-hot hardware for NASA or the Defense Department? Pick up VxWorks and WindRiver -- and welcome to C++
Want to write your own O/S kernal? Hell if I'd do it in C. C++ gives me nice namespaces and modules and an easier way of organizing things.
So yes, C++ is going to be around for a long, long time. And the concepts you learn in C++ -- assuming you can become a good C++ programmer -- are going to make you a much more proficient programmer in any of the "better" languages.
But fair warning: if you dabble? Yes, you'll be Homer Simpson.
Beats me. I didn't say the existing kernels were C++. I said if I wanted to write a new one it would be in C++. I certainly know the existing kernels are C++. Some of the kernel code for popular Operating Systems -- in production now -- goes back 30 or 40 years.
If I'm not mistaken, the Windows kernel has evolved quite a bit to C++. Even the core C files are compiled using the C++ switches. Not sure, but not relevant to my point either.
Hope this discussion helps the poster, which is the goal here. Like I said, you made some great points, and I agree with quite a bit of what you wrote. But understanding the exceptions and edge cases are important, even if the guy doesn't choose C++.
The reason why you probably would want to write your kernel in C over C++ is that C++ does more 'under the hood' and when you're writing an OS you want to have your code as transparent as it can possibly get. Any side effects that are not explicitly mentioned in the code will get you burned at some point.
I love both C and C++, although I don't use them currently. And I can't imagine using them in the future.
The issue here: is there a language that is both low-level enough to write hardware drivers yet high-level enough to abstract away anything that I might want? Close-enough to the metal to bit flip with the best of them yet powerful enough to create and organize large hunks of code?
I think the answer is pretty clearly C++. C is a very close second, but the entire reason from evolving from C to C++ was large development situations.
Would I write a new web-app in C++? Heck no. But software development is a lot bigger than the little corner of the world I have my fingers in, and I can easily see where C++ will be around 20 years from now -- and for new development, not just maintenance. Perhaps even 50 years. So no, not a dead end by any means.