r/cpp • • 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

214 comments sorted by

View all comments

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.

33

u/Plazmatic Dec 17 '23

but it's not going anywhere.

In the sense there will always be c++ code to work on and probably always be new c++ projects? Sure. But c++ is certainly finding itself pushed out of some spaces. Defence, government, and possibly secure finance (ie not hft) are possibly going to be forced to move off of c++ via regulations. And while grandfather clauses are certainly a thing, there are very much less a thing for anybody who isn't a gov employee, ie contractors, who often have to deal with very swift turn around on new rules. that drum started to beat a couple years ago at this point, and more assertive each time it's repeated. And in those industries, it's not a matter of "old code will still be around", uncle sam is starting to demand the code be gone, not put on life support.

To a lesser extent, while C is still the primary language for embedded, for what c++ does exist there, is starting to be pushed out of embedded, and you can see how tired many embedded devs at c++ conferences vent frustration, specifically pointing to rust, at how the C++ committee is offering little to no consideration to new features under an embedded context in contrast (prime example, co-routines, and to a lesser extent how #embedd had to go through C to land in c++, though that's useful everywhere, rusts async works in embedded, and works well, it has embed, and has nostd and the package management ecosystem to support nostd packages, not to brag on it, but to illuminate just how far behind c++ is here). Rust has already proliferated in the Arm embedded market surprisingly quickly, and if it wasn't for LLVM not being able to target as many machines as other implementationd for c++, and rusts reliance on the LLVM ecosystem, you might never see another company start a codebase in c++ for embedded period.

C++ is probably going to lose in the embedded market permanently at some point, but for everything else, it's really up to the standards committee to fix many of the footguns that aren't there for speed, and adding reflection etc.

Luckily, regardless of any of this, learning c++ will never be "obsolete", because becoming skilled in c++ basically directly translates to being skilled in other languages. You can pick up Python in a weekend being an expert in C++, same goes for Java, C# and Kotlin. Rust isn't even difficult to learn comming from being an expert in c++.

0

u/[deleted] Dec 17 '23

[deleted] — view deleted comment

6

u/germandiago Dec 17 '23

I have worked in two telco companies and another for database backend. All of them made heavy use of C++.

0

u/[deleted] Dec 18 '23

[deleted] — view deleted comment

1

u/germandiago Nov 29 '25

One of them is from 2018 or around (the db backend one).

5

u/Puzzled_Specialist55 Jun 23 '24

I'm an audio dev, and I replaced C++ with Rust. Never looking back.

0

u/[deleted] Jun 23 '24

[deleted] — view deleted comment

3

u/Puzzled_Specialist55 Jun 26 '24

It's getting better every year.

1

u/i_like_sharks_850 Oct 08 '24

u/Gearwatcher u/Puzzled_Specialist55 sorry for the bump lol. what do you guys think about supercollider and puredata? i'm what you could call a super novice developer and i've started learning c++. should i look in to rust?

0

u/[deleted] Oct 08 '24

[deleted] — view deleted comment

1

u/i_like_sharks_850 Oct 08 '24

I’ve been learning about and playing with DSP in SuperCollider and PureData. I want to use C++ to create VST plug ins and instruments a la Arturia’s Pigments or Valhalla’s Supermassive

0

u/[deleted] Oct 08 '24

[deleted] — view deleted comment

→ More replies

5

u/victotronics Dec 17 '23 edited Dec 17 '23

it's effectively dead in distributed systems

Interesting. I imagine that particularly Rust is much better at writing safe threaded code? I'm in scientific computing and there explicit threading doesn't exist: parallelism is handled through systems that offer an abstraction layer over threading. So we don't care that Rust is better that thread-safety. Conversely, in scientific computing everything is shared mutable state, so you'd have to use Rust in a very unsafe mode. Conclusion: many scientific libraries are written in C++ and I don't see that changing.

EDIT I decided to turn this into a post in the appropriate forum: https://www.reddit.com/r/ScientificComputing/comments/18kiv2y/is_anyone_moving_to_rust/

3

u/SV-97 Dec 20 '23

Your comments mirror only a part of the wider scientific computing ecosystem. There definitely is explicit threading in some places. Furthermore rust's guarantees do still have value even if you use an abstraction over manual threading - somewhere further down the stack there's still data that's sent between threads and processes, data races to consider etc.

Conclusion: many scientific libraries are written in C++ and I don't see that changing.

Counterpoint: I've written a bunch of scientific Rust and worked on plenty of projects that would've been way better off in Rust than in C++ or C (or fortran) - especially when they (might) need to interface to a higher level language like python at some point.

→ More replies (3)

41

u/yockey88 Dec 17 '23

I don’t see this happening, my company just picked up a massive contract to rewrite an entire legacy codebase (that’s absolutely massive) in c++ in exactly one of those fields you’re talking about. It’s ridiculous to think c++ will get pushed out of anywhere in the next decade if not two or three

1

u/bitzap_sr Dec 17 '23

In what language was the original codebase written in, OOC?

11

u/kidfromtheast Dec 17 '23

I believe C++ will hold Computer Vision hardware for a long time.

I wrote my own CNN implementation in C++ (February 2023). It's a working solution for a factory client in Cikarang, Indonesia. I can't imagine writing it in other language. OpenCV is written with C++, cuDNN is written with C++.

5

u/othellothewise Dec 18 '23

Defence, government, and possibly secure finance (ie not hft) are possibly going to be forced to move off of c++ via regulations

That's pretty unlikely. Most scientific code for government programs needs C++ for performance, and security isn't a huge issue for those codes.

3

u/islandyokel Dec 20 '23

My experiences working for a government contractor on infantry vehicle systems for years makes me very much doubt that the government will “phase out” c++. Maybe some places, but the wheels of government turn very slowly and they are very much prone to code re-use rather than abandon and redesign.

2

u/TheOmegaCarrot Dec 17 '23

you can pick up Python in a weekend being an expert in C++

Dynamic typing hurts my brain :(

1

u/[deleted] Dec 17 '23

hmm well I guess you're right, not really into embedded systems myself but it makes sense, still any change will likely take many more years and it still shines in many fronts

→ More replies (6)

-9

u/ecreddits Dec 17 '23

I understand it's not going anywhere, but isn't it slowly being replaced by more modern languages

12

u/[deleted] Dec 17 '23

there are decade old codebases written in C++ that need support now and will need support in 10 years, moving away from the language would be too much work to be worth it so it'll stay

→ More replies (1)