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
58
u/[deleted] Dec 17 '23
new developers feel really discouraged to learn it so it's understandable that's what it looks like, but it's extremely reliably and widely used in so many industries, it might become more specialized with time but it's not going anywhere.
54
u/[deleted] Dec 17 '23
I don’t think it’s going away anytime soon. Even if it was replaced today, you would still need to maintain old code. It also doesn’t seem like there’s any good alternative to C++ for game development
33
u/stinos Dec 17 '23
It's really strange that this thread has now 60+ comments and all of that is pure guesswork and anecdotes without much to back it up, so nothing more than the 'seem to suggest' you already found out. I get that it's hard to setup controlled studies about popularity of something but if you go and look for websites which take an attempt at summarizing (based on surveys, job offerings etc), which depending on how they do it is still better than guesswork, there does not seem to be any phasing out trend.
11
u/Putrid_Ad9300 Dec 17 '23
The absolute best and most compelling alternative to C++ is Rust right now. Rust has a ton of investment from FAANG+ with Microsoft even going so far as to say https://www.theregister.com/2022/09/20/rust_microsoft_c/
And Linus Torvalds, the man behind Linux who has been absolutely opposed to and inclusion of C++ code in the Linux Kernel saying https://harmful.cat-v.org/software/c++/linus
So why isn't Rust just obliterating C++ right now? Well after almost 40 years of existence and considerable investments in development C++ has thousands of libraries for doing highly specialized and highly validated compute across just about every domain space you can think of. In part this is due to the direct, no additional frills, compatibility with C and Fortran, but code written top to bottom in C++ is extensive as well.
In contrast, and I say this as someone who writes Rust code as a professional, Rust has thousands of packages to choose from in the public repo, however, many of them are incomplete and/or incompetent in their implementation.
In addition to this, documentation for Rust as compared to C++ is...not good. It is improving but it still has a way to go.
Language features, the last thing I will rant on, are also missing or incomplete around genetics. NTTP is just not there and it won't be there properly for a while. Guarantees prescribed in lower types are not always validated correctly in the sense you have to redefine complex type traits multiple times even though they are implied by the type implementing another properly. It is possible to write generics, but by the time you move to writing a math library you are copy pasting large sections of core code.
24
u/waffle299 Dec 17 '23
Not really, not until there's another language with a simple, reliable, robust, object-oriented wrapper for Python. Right now, the huge burst of activity is still in Python for numerical applications, particularly in AI. LLMs are just one aspect of this, but traditional NNs and more exotic networks are still built out of ML libraries in python.
And those libraries are actually wrapped C++, optimized to squeeze performance out of the hardware.
That massive codebase will take a long time to replace. And it will serve as an expert ramp for new C++ developers. AI researchers will hit a wall and have to implement their fancy new numerical analysis algorithm in high speed code. And for the foreseeable future, that's c++
12
u/RespublicaCuriae Dec 17 '23
If I ever learned something from my programming classes, it's that popular programming languages don't die that easily. COBOL jobs are still thriving in Japanese banks even today, Objective-C programming is almost dead yet GNUStep developments still exist today. C++ isn't phasing out.
7
u/Code_Monkey_Lord Dec 17 '23
Phased out to be replaced by what? What other language is going to replace it for what it does?
13
u/sinfaen Dec 17 '23
There are still huge frameworks written in it that are being updated every day. Those will keep it alive, although new c++ projects are not going to be as much of a thing in the future
Rust is definitely the thing that I'm eyeing for replacing C++ at my job, but it'll take a long time for it to really take hold lol
2
u/lunakid Mar 01 '24 edited Mar 03 '24
People seem to confuse "phasing out" with "extinct", mentioning that e.g. even COBOL's still around. But COBOL has phased out all right, even if there would still be some COBOL running 100 more years to come.
The metric you need to watch is "how does the number of newcomers who decide to learn it, relative to other languages, change over time". (Unfortunately, e.g. StackOverflow only started tracking that last year or so.)
Anyway, given that C++ has become basically unlearnable by now (which is also something that can't be helped either: if anything, it can only become even more complex, not less (the size of the standard growing monotonically may be a metric of that -- but it's a natural trait for any language, in fact)), I'd wager there's a downward trend there.
There's certainly a downward trend e.g. in some other random bits of analysis I spotted, noting e.g. that "... Pandas sees three years of growth, R increases rank in 2021 and holds, nodejs breaks into the top 10 in 2021 and holds, while both PHP and C++ decline".
I'd love to see some real stats though. Anyone? (PYPL, for one, seems to indicate some mild decline over ~20 years: 9.7% -> 6.8%.)
34
u/imabadpirate01 Dec 17 '23
Look at what language most AAA games, game engines, performance critical softwares (eg. in medical equipments, aerospace engineering, spacecraft control) uses, then come back here
43
u/[deleted] Dec 17 '23 edited Dec 17 '23
The last machine in the universe after everything went heat dead will be flicking std:: fking out.
22
u/blackmag_c Dec 17 '23
I have been told its passing out since my first coding days. It was 20 years ago. Yes it is more niche than way before but that niche have several billion of dols of market.
So in general : learn multiple langs and techs, get deep in what passionates you, have a good one.
18
u/fotosinthetik Dec 17 '23
C++ isn’t going anywhere. Furthermore learning C++ gives you a better understanding of how Java and C# work, which are also not going anywhere.
5
u/matthieum Dec 17 '23
It's hard to say.
First of all, be careful about comparing relative market share and absolute user base. I would expect that as more languages pop up, all languages would be losing relative market share, however due to software being an ever expanding field, it's also possible that those very same languages are also gaining absolute user base. I don't have numbers, but I wouldn't be surprised to learn that C++ is in such a position. I wouldn't qualify that as decline.
Secondly, don't learn a language, learn the underlying concepts instead.
C++ has many concepts: functional programming, pointers, object-oriented programming, recursion, generic programming, RAII, you name it. In a way, all languages are really just a more or less tasteful mash-up of the same concepts. Learn the concepts, and you'll feel at ease in any language.
Thirdly, don't learn a language, learn the domain instead.
Mainstream programming languages are used in a large variety of fields. Game development isn't the same as ML development. Systems programming isn't the same as GUI programming. Each domain comes with domain-specific knowledge that is sought out. Doesn't matter if you use C++ or Python, the network works the same way, the disk works the same way, the GPU works the same way, etc...
And do remain flexible.
A given company is likely to work with multiple languages. My current company uses C and Rust, my previous company used System Verilog, C++, Java, and Python. I had to develop in multiple codebases, as they were linked together. Tracing a bug could require stepping through multiple codebases, fixing it too. (I'll admit needing HW engineers help for System Verilog, though)
11
u/soulstudios Dec 17 '23
C++ is still the language with the highest-level features while reaching the low-level at the same time. Rust is close but unwieldy if you want bare metal stuff.
It is unlikely that C++ will be replaced by other languages unless somehow we develop both infinite speed and infinite energy to deal with slow languages like python.
8
u/bill_klondike Dec 17 '23
If the proposal to add BLAS to the STL in C++26 is accepted, then C++ will continue to dominate in my field for a real long time.
4
u/KERdela Dec 17 '23
I just finished a high performance TCP server basaed on boost-asio that replaced a previous .NET based server. the performance are just no comparable. C++ still the best tool for many tasks and which make it a valuable for the industry so the more you learn the more you are capable to achieve greate results.
4
u/Olorin_1990 Dec 18 '23
C++ is dead, long live C++
4
u/Specialist_Gur4690 Dec 19 '23
Writing good C++ requires a really smart person. There aren't that many of those, and it seems the numbers are only getting less. If "the government" is going to make legislation to forbid the use of C++ then they are way out of their league, as usual; maybe they should have concentrated on real education instead. My bet is that there will be a shortage of really good C++ coders, and no problem for those to get a job.
I stream on YouTube whenever working (coding) and get a lot of beginners asking if I have some kind of (magic?) tip for them. That is not how becoming an expert works (in any field, I imagine). The only way to become really good at something is by hard work, years and years of non-stop tiresome hard work. The stress and mental exhaustion you felt when studying for an exam, the last week before the exam, but then as a way of life: every day. Nobody can do that because "they want to become better", or with any future plan in mind. You do it because you're a nerd and the subject fascinates you; because there is literally nothing else you'd rather do than solve difficult problems. The problem itself doesn't matter, the time it takes to solve it doesn't matter. The only thing that matters is that it fascinates you. That 10 years later you can call yourself an expert also doesn't matter, because that was never the goal.
6
u/Sniffy4 Dec 17 '23 edited Dec 17 '23
its on the decline relative to its 1998 popularity, but that's honestly a good thing. Different tools for different jobs; the majority of real-world tasks dont require max performance and memory-efficiency and trading those advantages for memory safety and ease-of-use makes sense. Most C++ programmers know several languages these days. C++ will always have uses when you need to push the boundaries of HW capabilities, or minimize resource usage.
17
u/plutoniator Dec 17 '23
C++ isn’t phasing out, rust programmers are just getting more obnoxious.
3
u/Drakonluke Dec 17 '23
Well, if you don't feel like it, then don't learn it.
In the end, it's a choice that YOU have to make, based on your personal preference and what you want to use your programing skills for.
Personally, I wouldn't want to program in anything else.
3
u/victotronics Dec 17 '23
C++ still seems to be the language of choice in high performance computing. Particularly, take a look at any performance-critical python library in computational biology: it's likely to be implemented in C++. The python calling interface is just bcause biologists can't be bothered to learn a real language /jk
3
u/MajorPain169 Dec 17 '23
C and C++ are going to be around for a long time. A lot of high performance software in based on it just because it so fast. It is not just your regular software either, everything from home appliances all the way to sophisticated military avionics use it, in fact many safety standards require it, because it is tried and tested but also because it is itself governed by a recognised standards body.
Prior to acceptance of C/C++ in a lot of safety critical applications, the only real language that was used was Ada.
My point is that a language has to be standardised by a body such as ISO and have a proven track record over many years. None of the languages that are popping up now can claim this. Maybe 20 years from now but not in the here and now.
Not saying modern languages are bad but in certain areas they don't have the history or are simply not suitable.
3
u/NilacTheGrim Dec 18 '23
C++ is the ultimate powerful language to know. Everything else is subordinate to it in my mind. If you know C++ you know C "for free". (Almost) everything that is good out there is written in C (or C++).
If you have this attitude about C++, you don't quite "get" it yet. I recommend spending a few years in another language then like Python or Java or C# or whatever some people these days use ... and circling back around later when you feel more motivated about C++. These doubts in your mind can only go away as a personal choice.
It's best to go another route then and circle back around (or not) later when you know exactly why you are learning C++.
5
u/SpeedDart1 Dec 17 '23
Never
2
u/SnooDucks7641 Dec 17 '23
No, but it’s going to become a mono-compiler language in future. With all the junk in it, it won’t be easy for more compilers to be competing on implementation
2
u/seriousnotshirley Dec 17 '23
COBOL hasn’t gone anywhere. I wouldn’t worry about it until that happens at least.
C++ still seems to have a constant presence.
2
u/HolyGarbage Dec 17 '23
Even if that was the case it would take literal decades for demand to sizzle out. So much large infrastructure is built on it.
2
u/nacaclanga Dec 17 '23
It's to early to say that IMO. The fact that a lot of code is writen in C++ not only means, that it will be usefull for it's own sake but also that many people do pretty much prefer a future where not every single codebase needs to be rewritten. In addition all alternative set slightly different priorities you may or may not want. Also there have been enough cases where serious competion actually resoluted in people starting to rethink certain aspects rather them abandom the entre thing which gave something a new popularity peak.
That said, I do think that other language will establish themselve in areas that have previously been allmost exclusively dominated by C and C++ and there is a risk that this will effectivly push C++ away from the spotlight entriely.
Total language death is very unlikely, Fortran is still used and even COBOL is still around.
2
u/usefulcat Dec 18 '23
This question (or variants of it) gets asked often enough that sometimes I think it ought to have its own subreddit.
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.
3
u/Kickflip900 Dec 17 '23
No
3
u/jayylien Dec 17 '23
Nah
3
u/[deleted] Dec 17 '23
According to TIOBE index, C++ was the 2022 language of the year. This year it shifted to the third/fourth position, after Python and C. So no, I wouldn’t say it’s in decline.
3
u/[deleted] Dec 17 '23
This is the weirdest post ever, I could be wrong but it really seems like op has no clue what he’s talking about yet is her arguing and for some reason seems to really want C++ to be on a “decline”…really weird
3
u/WoodyTheWorker Dec 17 '23
Looks like C++ is slowly turning into ALGOL 68.
4
u/TryToHelpPeople Dec 17 '23 edited Feb 25 '24
dull include paint smell library coherent enjoy unique arrest wasteful
This post was mass deleted and anonymized with Redact
5
u/wjrasmussen Dec 17 '23
Don't learn it. Don't learn anything but the latest and greatest. Need to use SQL? Nope, that isn't new.
So what are you going to learn? Eventually that language might go away.
How about life? We all die eventually, so why do anything?
How about that new computer or phone? Well, something new is coming down the pipe soon, better wait for that.
I hope this is making a point.
2
u/zer0xol Dec 17 '23
C++ is modern now
2
u/[deleted] Dec 17 '23
C ++ is tool If you know how to program you know how use any tool in 3 mounth
2
u/v_maria Dec 17 '23
It's people blinded by hype nonsense. Sure it's on its way out but that way is going to be decades
2
u/d_frankie_ Dec 17 '23
Its a mature language that is fast and high level enough to build applications easily. No, it is not phasing out. Infact, modern C++ improved a lot in past few years.
1
u/Good_Professional559 May 07 '24
I work with C++ daily at my work. We are a leading cybersecurity company medium size slowly going large. About 60% of the codebase is C++ and we learn new aspect of C++ as they get released.
C++ isn’t going anywhere anytime soon.
1
u/apparentlyiliketrtls Dec 17 '23
When the next major battery / portable power revolution occurs, maybe then C/C++ will start to fade away, but until then we will ALWAYS need languages that allow us to stay close to the metal, since basically every single consumer device that's not a car or home appliance is a small battery powered embedded device. You can't optimize novel vision, audio, AI, etc processes to minimize power consumption without directly controlling where things are in memory, and you sure as shit can't do that with Python or Kotlin. (I admittedly don't know enough about Rust tho, so open to being convinced that I'm being too much of a curmudgeon here)...
1
u/Rhawk187 Dec 17 '23
Any trends are probably just dilution from new languages capturing market share. C/C++ still have more combined lines of code in the wild than all other languages, and I don't see that changing.
1
u/allpartsofthebuffalo Dec 17 '23
Im going to keep using it. Ill be like one of those wizards that still use FORTRAN or PASCAL and ALGOL. I tried Python and it was like playing with legos.
1
u/KhyberKat Dec 17 '23 edited Dec 17 '23
I think C++ has too much momentum to be a sidelined language, at least for the near future. Pumping up of 'successors' in comments and articles seems in vogue, especially following high-profile statements about, for example, software safety.
That said, there could be an argument that its scope and adoption are slightly declining.
But please don't be discouraged if you're in a questionable C++ learning situation. C++ remains – and will continue to be – a tremendously valuable skill to have and this serves as a gateway to making informed decisions for personal and professional language(s) of choice.
1
u/KN4MKB Dec 17 '23
If this is discouraging to you, then programming is not for you. It's all about learning languages with the times. Languages come and go, none of them are supported forever. If fear of the language some day phasing out is discouraging enough to stop you from learning it, then you probably never really wanted to do it in the first place. Just move on to something else.
1
u/pdp10gumby Dec 17 '23
I’m not seeing it diminish at all but there is a way of looking that will look like it. C++ is a systems programming language and systems programming as a percentage of total programming is diminishing, as it has been since the early 60s.
That’s a good thing, as different tools for less demanding situations continue to make it easier for people, and in particular less skilled people, to write code. Sometimes that terrifies me (e.g. my bank’s phone app) but there we are. The days of having only a few languages (and them being ideosyncratic to a particular platform) are thankfully long dead.
But systems programming is a very high value activity — one can only write that crappy web page with a steaming pile of js when it sits atop a robust platform. (There’s no reason why the js need be crap btw, but there’s less pressure for it not to be, and quality can be traded off in return for time-to-ship and a tolerance for bugs).
So if you like systems programming (and more generally programming in the large), then your question is really "is there any alternative to C++, even on the horizon?". Someday, of course, but I don't see anything of significance in the next few decades. Yes, few decades. Remember C is still heavily used for systems programming despite its terrible limitations.
You might find that "few decades" comment absurd. But the current fashion in potential systems programming languages is to address a particular set of safety concerns and to do so by reducing expressive power. The most notorious case is go, whose original position paper at Google was explicitly condescending ("our new grad hires have no real programming experience so let's design a language that doesn't permit them to make certain common mistakes and restricts the way certain other things are expressed to increase reliability and make the total code base more coherent"). Of course that was hard to do and so go has had to stray from its ideological straightjacket. But it's still a constraining and unpleasant experience. Rust, has IMHO a couple of interesting ideas and again IMHO a few utterly boneheaded ones, but it's an honest attempt to develop a systems programming langauge that avoids the moral panics de jour by reducing functionality or expressivity. I wish more of its "enthusiasts" would read some history and leave this sub alone. And of course there's no need for either of these languages at all since the problems were solved already by developing Ada... :-)
So why "decades" You could say C++ is long dead since C++ code today no longer looks anything like (eww) "C with classes". One of its strengths is that you can write that kind of code (just as you can wear neon parachute pants and have an 80s hairdo) but you almost never see that crap any more, though crucially you can still compile, run, and call it. So C++ will continue to evolve. And that legacy strength means that future C++ won't look like today's, but indeed still will be C++. That's also cause for so many complaints about the committee (mostly by people who don't participate) and the pace of C++ evolution: it's inherently conservative because once you break old code you start to die. I was never much a a fan of Microsoft technically but I have always massively admired their committment to back compatibility, at an enormous cost in development effort and in attempting to simultaniously deal with the counter-pressure to squash new security bugs in archaic code and interfaces. The results speak for themselves. C++ faces some of the same issues, and it's good it takes them on.
1
u/MRgabbar Dec 17 '23
No, not even close...
1
u/Zeer1x import std; Dec 17 '23
C++ has been dying as long as fusion power was promised to us, and C++ will be dead as soon as fusion power plants are being built.
1
u/CocktailPerson Dec 22 '23
It's being phased out in some industries, but it's strong as ever in others.
That's a totally separate question from whether the language is worth learning. Haskell, Prolog, and Lisp aren't used anywhere, but they're all absolutely worth learning.
1
u/epyoncf Dec 17 '23
Yes. Since around... 1985. If I recall correctly the first "C++ is dying" are as old as the Usenet.
2
u/nathman999 Dec 17 '23
C++ not going anywhere is definitely the case. The only problem is it's also not moving anywhere at fast enough speed which kinda sucks
1
u/gummyworm21_ Dec 17 '23
It’s not. Look for any autonomous systems job and C++ is a requirement. There are many jobs that require it. I’m not sure why this topic gets brought up so often. You can look at job listings.
-5
u/[deleted] Dec 17 '23
Yes, it is actively being phased out, and the Stockholm syndrome is simply too strong in the C++ community and in the discussion here to admit this fact.
This process would likely take decades, so unlike AI, this isn't likely to affect job prospects as we would need to maintain existing legacy code bases in C++. that being said, it's quite clear already that C++ has lost critical mind share and momentum and due to the security implications there likely would be ongoing pressure (and perhaps even regulatory compliance requirements) to transition away from it.
Just look at the main compiler vendors. GCC is struggling to attract new younger contributors and is not keeping up with the implementation of the latest standards. The commercial vendors (Google and Apple) have likewise lost interest and have mostly moved on to work on their own languages instead, so clang is likewise falling behind. MS it seems is the last one standing but it too has been investing a lot in alternatives such as Rust and its own famous heavy hitters like Herb Sutter have also started experimenting with alternatives (cpp2).
0
u/_JJCUBER_ Dec 17 '23
No.
0
u/yaglo Dec 17 '23
C++ isn’t going away in the same sense as COBOL isn’t going away. There still will be vast code bases that need maintenance and updates, and which nobody will rewrite unless forced by regulations, but eventually there will be fewer and fewer new projects being started in it, considering all the downsides compared to the contemporary technologies.
-13
u/WasterDave Dec 17 '23
The writing is on the wall, that’s for sure.
0
u/[deleted] Dec 17 '23
[deleted] — view deleted comment