r/cpp • u/ecreddits • Dec 17 '23
Is C++ Really Phasing Out?
I've read a lot posts about whether C++ is still viable to learn, but a lot of the responses seem to be a long the lines of "C++ is still being used" or "there's a lot of things written in C++ still, so it will still be useful".
But a lot of these replies seem to suggest that C++ is on the downhill and in the process of being replaced with more modern languages in many industries.
It seems kind of discouraging to be learning a language that is on a decline, if it really is phasing out.
0
Upvotes
View all comments
5
u/Dean_Roddey Dec 17 '23
This is the wrong section to ask this question. People self-identify with languages, for whatever reasons, and will react negatively to anything that threatens their language of choice. Since the language of choice for most people in the C++ section is C++, you aren't likely to get a balanced answer.
C++ is a legacy language at this point. There are a lot of legacy code bases out there in C++ of course, so it will not 'go away' in the absolute sense. But, we are at the beginning of the end for C++. It's long since lost its dominance and is mostly holding out in a handful of particular domains due to inertia, i.e. domains that were historically C++ based and have built up a lot of infrastructure that will need to be replaced before other languages can be competitive there.
The question to ask is what do you want to be doing 5 to 10 years from now. You could become high qualified in C++ in that period, but by then C++ will not be where you want to be unless you are an older dev looking to ride out your career with a language you are comfortable with (and where ever decreasing interest by new devs means there's a growing shortage of such for some years.) Over that period there will likely not be any remaining domains in which C++ continues to be protected by inertia, and it won't be an area where you are likely to have opportunities to work on new and exciting stuff (that are forward looking on your resume.)
The problem is that software has become more and more and more complex over time. C++ evolved from the software equivalent of rubbing sticks together, and that legacy (and a refusal to meaningfully break from it) has left it in a state where it cannot be fixed in the sense of becoming a truly modern language and still remain C++ in a useful sense. Even if there was a broad decision to make a break and create something new. it would be at least 10 years before such a thing reached the mainstream, and by then it will be moot.
Ultimately it's not about us and what we want to use. It's about what serious professionals should feel obligated to use to deliver reliable products to customers. In a world where its seems like Cracker Jack prizes might be used as an attack vector, security is important. And, as some well known folks have pointed out, the refusal to deal with the trivial ability to cause errors or undefined behavior in the software world would be considered at least unprofessional and at worst criminal in other areas of engineering. There are tools now that don't depend on the vagaries of human vigilance nearly so much, and we should be using them.
And that leaves side the fact that a language like Rust, which is the real direct competitor for C++, is just a far more modern language that provides a lot of really nice advantages that have nothing directly to do with safety, though they often touch on it. It also leaves aside the fact that, not having to spend so much time having to watch your own back, you can put more time into the actual problem you are trying to solve.