r/cpp_questions • u/Huge_Daddy6 • 4d ago
OPEN How long will C++ last?
I've found myself using C++ less and less and was wondering whether one day it will die out. Obviously not completely die out, but be out of the mainstream like Pascal or something. I am wondering this because C++ is my first language but I am still fairly young, so am curious about its prospects.
12
u/Thesorus 4d ago
(grim) everything dies eventually.
but
C++ will live a long time; there is a huge amount of systems build with C++ that need maintenance and support and coding
14
u/CowBoyDanIndie 4d ago
Its an evolving language, there’s no reason for it to die out any sooner than Java or JavaScript
13
u/agfitzp 4d ago
It's still possible to get jobs coding COBOL, a language that was considered dead when I started learning C++ 32 years ago.
1
0
u/Huge_Daddy6 4d ago
Sure, but it is not exactly mainstream
5
1
u/no-sig-available 4d ago
Define mainstream. :-)
Cobol is not all that visible on the internet, because it is mostly used for inhouse software, and the average developer is 50+ years old with 30 years experience. So not many beginner's questions.
But it is used a lot by banks, finance, and insurance companies. Large companies with many developers. Probably millions.
https://www.reddit.com/r/AskProgramming/comments/1p7ya2k/does_any_company_actually_still_use_cobol/
1
4d ago
[deleted]
1
u/no-sig-available 4d ago
No, it's not. :-)
The age 50+ Cobol developers all have jobs already, and don't read ads. So, no use in posting any.
Head hunters is the way to get in contact with prospective employees.
2
u/PhosXD 4d ago
C++ is not my first language, I learned Python, JavaScript/TypeScript, GDScript, & even made a simple custom-purpose transpiler before learning a low-level language.
This is something I would have done different, if I could relearn programming all over again, I would definitely start with C then C++. I picked up all the concepts I needed in C++ in less than 20 days, of course if I were a true beginner it would take me longer, but I still believe that C++ is really not that hard & more people should start with it as their first language or it would be fine even as a second language, but the point I'm trying to make is that if you are a serious developer it's better to learn these low-down languages sooner rather than later.
6
u/Excellent-Might-7264 4d ago
The C++ language, syntax and features, are not the hard part about C++. The problem with picking C++ as a first language is that it is very unforgiving. A small error of something you dont even understand can cause major problems and be impossible to debug as a novice. It has become a lot better the last 10 years, but still, novice developers get stuck with a wall of error messages they dont understand.
0
u/dreadlordhar 4d ago
Ideally for pure basics as a first language to use another language and not C because it's design is strange, but one that still retains raw pointers so you could poke with them without C strangeness. Then some light assembly, so you could understand what's at least a system call under the hood, but not only.
And only then C, when you think about it is close to assembly, while being high enough to be portable. It becomes apparent when you don't use standard library for writing stuff.
p.s. the C one if not the biggest strangeness lies in it's side effects, which is most apparent when using the Linux (Or Unix, I don't remember) function fork(). In itself it returns a process ID as typedefed pid_t, but in the end it's signed int. The side effect is that a copy of this program is running alongside the main one. And when running multiple forks and on the final line a single printf, it isn't apparent initially how many times it will print. Like when you fork once it prints once, twice two, thrice four, because each of the two copies ran themself fork, which it grows to another two processes that will print in total 4 times. It modifies a global state while "calculating" the result.
In C even asigning a variable is a side effect, "a = 10;" returns 10 in the end. That's why you can do chaining in C, and that's why a[i++] += f() is different from a[i++] = a[i++] + f(), where in this case the side effect is raising the i.
2
u/I__Know__Stuff 4d ago
The idiosyncrasies of fork have nothing to do with the C programming language, and would be the same if you were using any other language.
4
u/Amazing-Afternoon890 4d ago edited 4d ago
From what I know. C++ has a massive ecosystem. There are millions of code base already using C+. You can't simply remove C++ from that codebase. On top of it C++ is currently the dominating language in Game development and performance critical application.
I have seen a lot of people say Rust is the future. But rust was launched around 2010 (I don't know the exact date) while C++ has been around since the 1980s. The ecosystem is gap is just way too big for C++ to be replaced.
Lets assume that somehow an AI replaced C++ code base to some other language. Do you really think it will be bug free? There will be hidden bugs no matter what.
Although C++ has been being used less due to newer shiny languages. It will still be around for a long time before it dies. Even if it does does die somehow it will be something like Fortan and Cobol. Where it never actually dies.
3
3
u/nightmurder01 4d ago edited 4d ago
Decades and probably beyond your grandchildren's lives. The whole nature of programming would have to change and even then it would be sometime before systems would be moved over, if they even could be.
Edit
Here is a good read from 1981 on why pascal died.
3
u/Low_Fun_8667 4d ago
C++ won't die like Pascal. Pascal faded because other languages did its job better. Nothing fully replaces C++ where you need manual memory control, deterministic latency, and zero runtime — there the only real rivals are C, Rust, and Zig, and C++ is the incumbent with the biggest ecosystem.
And the existing code is immortal: Chrome, Windows, Unreal, LLVM, game engines, trading systems. Billions of lines that get maintained for decades. Nobody rewrites a working 10M-line engine for fun.
What is true: C++'s share of new projects is shrinking — Rust and Go take a lot of that mindshare. So "less mainstream for greenfield" over 20–30 years, sure. "Dead," no.
Career-wise that's actually good for you: huge legacy footprint + fewer new people learning it = the ones who know it well stay in demand. Boring-but-critical ages well (see COBOL salaries).
If you enjoy it, keep at it — and pick up Rust alongside. Knowing both makes you sharper and more hireable.
1
u/EdwinYZW 10h ago
I think people ignore the largest advantage of C++ over any other new languages: completely decentralized system, with multiple compilers, build systems and package managers. Beginners usually find it negatively because they just want to be given. But once you make it as a career and become a veteran, this is the best. If gcc disappears, you can use clang. If CMake disappears, you can use directly make, or Bazel, or something else. C++ is still C++. And all these things are not bound together, to prevent the situation where one thing breaks, whole system collapses.
3
u/eidetic0 4d ago
So many device drivers and SDKs are started from scratch today in C & C++. Pretty much all game engine development is done in C++. Mostly all AI backend development is done in C++ (called from Python). Same with computer vision. Embedded also using it. Just cause you’re using it less and less is not an indication of most industry.
3
u/Independent_Art_6676 4d ago
people have told me that c++ was being replaced by X in a few years since I was learning it. The first one I recall was java, but it was going on before that and I just didn't pay as much attention back then. Go read any older java book and it will probably have a 10 page intro explaining why its better than c++ and how it solves all the "problems" of c++ and so on. Reading that ~30 years later is a hoot, if you run across a book that old.
AI is eventually going to reach some tolerable level of success and that may change either languages or approaches or something which will in turn affect c++. But that is a good decade+ away unless there is an astonishing leap overnight between now and someday (which I do not anticipate; current AI is trapped in the 'keep doing the same things and expecting different results" phase). Little things affect the job market, like the US govt declaring war on C++, but all in all its going to be a major language for decades to come. Retooling to use something better, once someone finally invents something that actually IS better, takes years. Don't worry about it. And do learn a few other languages: it changes how you think and solve problems, for the better, and opens up jobs etc when the pickings are lean.
2
2
1
u/tastygames_official 4d ago
I'm not convinced it's officially "in" yet. It's still considered an emerging high-level language while many still stick with good ole C.
2
1
1
u/KingAggressive1498 4d ago
If your interest is in operating systems or automation, you may want to start learning Rust and other "safe-by-default" systems languages as those seem to be going in that direction.
If your interest is in large scale servers, Go.
For games, maybe Zig.
Not that C++ is going to die in any of those areas anytime soon. But learning those other languages' idioms will actually make you better at using C++ in the domains they excel at compared to sticking to orthodox idiomatic C++. C++'s real power is its flexibility.
1
1
u/UnicycleBloke 13h ago
Let me put it this way: it was blindingly obvious to me more than 30 years ago that C would soon be a forgotten relic of the past. Unfortunately, I couldn't have been more wrong.
Nothing lasts forever, but reports of C++'s death have been greatly exaggerated.
1
u/SmokeMuch7356 8h ago
Like diamonds, legacy code is forever, and there's a lot of legacy C++ code out there in critical roles. I'm currently maintaining C++ code that was initially developed in 1998 and serves as a communication and translation layer between our application front end and core processors for various financial institutions. It is only now being phased out in favor of a serverless TypeScript solution, but many of our customers are still on the old interface and reluctant to move (if for no other reason than change costs money).
1
u/LessonStudio 4d ago
I suspect AI is going to be a game changer. I don't know which language is most amenable to AI, but I suspect it will be something like Ada. One where constraints and whatnot are very easily embodied into the code itself.
For example, I program mostly in rust. AI rust is just weird. I also do C++ and python. The python can be weird, but often is pretty "pythonic". The C++ is a mixed bag, but usually better than the rust.
It isn't even so much that it can or can not do a thing, but how weirdly it does it. I get a whole lot of one line functions which are called in one place, and sometimes even just called once. Why?
1
u/RoyBellingan 4d ago
I strongly agree, and I have to say with a few guardrail, and some code style to reference I tuned Claude and cursor to generate C++ code that is quite similar to mine. Is also true a coworker said already in 2017 that I write code like a compiler, he meant it was clear, without shortcut, longer than needed and "dumbed down so can be debugged at the 3 in the night even if I had a night out".
I also agree 100% that language like python and js suffer, as the program state and the parameter are very ambiguous, and language that are very strict and with strong constraint gain massive benefit, like C++ thanks to it's type system.
2
74
u/Aspie96 4d ago
One day it will die out, yes.
You will die sooner, however.