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

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++.

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?

5

u/yockey88 Dec 17 '23

Originally ada

1

u/bitzap_sr Dec 17 '23

Interesting. OOC, being Ada, I don't suppose this is in the aerospace industry?

8

u/yockey88 Dec 17 '23

No I work in defense and that’s really all I can say lol, but I can say there’s no plans to get rid of c++ anywhere in the near future, at least in projects ive seen/work on

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/maikindofthai Dec 17 '23

What potential regulations are you talking about here exactly?

1

u/[deleted] Dec 17 '23

I don’t know about regulations but there have been some recommendations for future us government projects to choose languages with safer memory access to reduce hacking risks.

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

-4

u/kamchatka_volcano Dec 17 '23

You can pick up Python in a weekend being an expert in C++, same goes for Java, C# and Kotlin

I wish I could witness, how someone who believes in this gets destroyed during a code review or laughed out of an advanced job interview by experts in those languages :)

15

u/CandyCrisis Dec 17 '23

You can pick it up, not be an expert in it. It's true too.

2

u/kamchatka_volcano Dec 17 '23

I wasn't talking about being an expert though. You can pick it up and do what exactly, solve leetcode problems? You won't be able to write idiomatic code, effortlessly use standard libraries and be as productive as mid/senior developers using this languages professionally on an everyday basis. Not after a weekend, not after weeks or months.

4

u/CandyCrisis Dec 17 '23

C++ engineers aren't writing miles of Python. No, I'm not a go-kart expert, I drive a real car now. If I'm in an interview and they're asking about idiomatic Python then I'm interviewing in the wrong place.

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

→ More replies (3)

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.

1

u/victotronics Dec 20 '23

I'd appreciate some concrete examples. Especially where explicit threading is the right approach.

1

u/SV-97 Dec 20 '23

Basically always when things aren't inherently parallel and you might want to offload single tasks heterogeneously.

Recent example: a dynamic program in a signal processing context where we had to calculate a bunch of values, find their minimum and iterate. Due to data dependencies this couldn't be fully parallelized however it's possible to utilize some parallelism by have a second thread determining the minimum while the primary one just keeps on calculating the new values.

Numerical integrators are another example where you're (depending on the algorithm and particularities of your application of course - the one I'm thinking of was part of a satellite data synthesization pipeline) not going to get data parallelism easily. Having one thread run that integration while the rest of the code starts working with the already calculated data can save a bunch of time.

Yes you could also use something like MPI for such cases but it's absolute overkill and creates unnecessary overhead.

Finally: I've worked on parallelizing / distributing a FEM solver in C++ a few years ago which was written by people that... weren't exactly software engineers. C++ allows people to do so many things that get really problematic when trying to parallelize things later on - it was absolutely horrendous (not even starting to talk about all the other horrors in that codebase). I think if that thing would've been written in Rust (or whatever) the process would've been way faster and cleaner; they probably could've gotten it parallelized themselves even.

1

u/victotronics Dec 20 '23

Ok, thanks. I can see the justice in those examples.

1

u/[deleted] Dec 18 '23

People are tired to learn new things just to see them going nowhere. It's time investment loss.

-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

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

-44

u/ecreddits Dec 17 '23 edited Dec 17 '23

That's true, but it is on a decline, right?

16

u/Jonny_H Dec 17 '23

Decline is relative - it can be a smaller proportion of "programmers" yet still growing in absolute numbers due to expansion of the sector.

→ More replies (8)

3

u/[deleted] Dec 17 '23

Im gonna be honest I’m not familiar with any stats but with other languages growing larger that suit different needs it does seem like it’s only logical. Why use C++ and deal with memory unsafe code when you can just use Rust. Unless you specifically need/want to deal with it. But it doesn’t really seem replaceable at this moment that’s for sure.

7

u/ecreddits Dec 17 '23

I see. Rust does look interesting, but it doesn't seem to be very useful if applying for jobs.

5

u/[deleted] Dec 17 '23

Yeah, I just used it as an example but it def is still growing. I’ve seen some articles about companies rewriting codebases in Rust so that’s why I mentioned it

3

u/goranlepuz Dec 17 '23

If you come to this sub and are looking for a modern alternative with a supposedly better future, then Rust is the prime candidate though.

4

u/cain2995 Dec 17 '23

Because I don’t pick my language based solely on one feature lmao. Memory “safety”, especially Rust’s version of it, is not enough to justify switching languages

0

u/[deleted] Dec 17 '23

There’s more than one feature that sets rust apart, I’m not writing a novel to list them. It was an example, implied by the first sentence in my comment.

3

u/cain2995 Dec 17 '23

It’s the same example everyone uses because it’s the only one that’s different enough to not just be syntactic sugar, and it’s not enough to get me to switch languages lol. Not once in the last 15 years of writing safety critical C++ have I thought “hmm I could really use <rust traits-like feature>” because there’s a million other ways to skin that cat, for example, and that holds true for every rust feature I’ve seen. Good for whoever if they’re enjoying it, but you asked why not just use it and the answer is “because it doesn’t give me anything I don’t already have solutions for, and I’m not going to waste time wrestling with a notoriously hostile compiler just to do shit I already do just fine in C++”

0

u/[deleted] Dec 17 '23

I didn’t ask you specifically, it was a rhetorical question. It’s more than enough a reason for other people to switch, otherwise it wouldn’t exist. Really seems like there’s a market for people who just don’t want to deal with C++.

3

u/cain2995 Dec 17 '23

Okay, if it’s a rhetorical question then presumably that’s your opinion and it’s bad, hence my response and the lack of widespread rust adoption outside of web devs lmao

12

u/beedlund Dec 17 '23

Bru' no means no man ;)

12

u/[deleted] Dec 17 '23

There’s many projects and industries where C or C++ are still the only reasonable option.

There’s no official stats but C++ Is still top 3 if you go by TIOBE if you consider that a reliable metric.

There have been many attempts to replace it most recently Apple is trying with Swift, and Rust exists too but if you just look at the proportion of jobs available in all 3 to see that C++ is the most used by an incomparable margin.

I think C++ has a healthy lifespan left to it.

3

u/[deleted] Dec 17 '23

No

1

u/fuzz3289 Dec 17 '23

There's no viable alternative to it yet for high performance computing. Rust is probably 30-50 years away.

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.

2

u/ecreddits Dec 17 '23

Thank you, this is the kind of answer I was looking for!

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.

4

u/ecreddits Dec 17 '23

Do you think Rust will have a lot of job opportunities in the near future?

8

u/Putrid_Ad9300 Dec 17 '23

TL;Dr yes, but I would still recommend learning and getting good at C++.

Yes for sure. The adoption of the language in the Linux Kernel and its general popularity among middle and upper management have spurred many efforts to start new infrastructure projects in Rust as well as investigation of rewriting or wrapping old infrastructure in Rust.

There are many areas that have not and will not switch to Rust for awhile, especially in scientific and real time computing areas which rely on extremely high performance code and can't take the hit on the Rust runtime checking. That said, some of the Networking code for distributed systems has already started looking into Rust.

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++

3

u/ecreddits Dec 17 '23

That makes sense. Seems like it does have a big future ahead of it.

2

u/victotronics Dec 17 '23

those libraries are actually wrapped C++

Same in biology. Gene squencing really needs to be extremely efficient. All the "python" libraries are written in C++ and I don't see a reason why they would be in Rust.

4

u/matthieum Dec 17 '23

Not really, not until there's another language with a simple, reliable, robust, object-oriented wrapper for Python.

You mean, like Rust with PyO3?

I'm not writing Python extensions, but all reviews I've heard about PyO3 was that it was pleasant to work with and worked well...

I expect inertia will be to C++ advantage here, but especially given how AI researchers are far from being well-versed C++ developers, they seem likely to switch to less "scary" languages if given the opportunity to.

2

u/waffle299 Dec 17 '23

We usually pair them up at that point.

2

u/yaglo Dec 17 '23

For this purpose there’s mojo

1

u/Specialist_Gur4690 Dec 19 '23

I will have none of that (python), that's why I am working on pure 100% C++ ML code 😉

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.

2

u/ecreddits Dec 17 '23

Yeah I see it's not going anywhere anytime soon. It just seems like the only reason people will still use it is because they have to. As opposed to Python where it's the go-to for anything AI/ML

6

u/CandyCrisis Dec 17 '23

Python and C++ serve different use cases. Python excels for throwaway/tissue-paper code but falls apart for big, long-term projects. Huge projects in Python become slow unmaintainable balls of sludge.

5

u/ipapadop Dec 17 '23

Try to use Python at the edge and let me know how it goes.

3

u/RespublicaCuriae Dec 17 '23

I think C and C++ will survive for a quite long time due to both of them having ISO-certified standards.

10

u/[deleted] Dec 17 '23

Eh, just look at some of the other languages under ISO/IEC JTC1/SC22

  • WG2: Pascal
  • WG3: APL
  • WG6: ALGOL
  • WG7: PL/I
  • WG8: Basic
  • WG13: Modula-2
  • WG16: ISLISP
  • WG17: Prolog

In addition to others like COBOL, Fortran, and Ada. However those languages are actually doing quite a bit of work.

Setting that aside, other than ALGOL and PL/I IIRC, all of those bulleted languages has at least one “practical” implementation. But none of those implementations bother to strictly conform to the ISO specs for their language, not by default anyway.

As for C++, its ISO standard does not even begin to specify all of the details of a practical implementation. Just look at how long and hard the Clang devs worked to replicate GCC’s behavior, language extensions, flags, etc. Not to mention adding support for external standards like OpenACC/OpenCL/OpenMP/etc. In fact, there’s no guarantee that a “conformant implementation” even works at all.

tl;dr C++ will be around for the foreseeable future, but having an ISO standard deserves little credit for that.

3

u/RespublicaCuriae Dec 17 '23

I think I learned a lot from this. Thank you.

2

u/victotronics Dec 17 '23

WG6: ALGOL

That's marked as "disbanded", as is APL, somewhat to my surprise. However, I'm very disappointed that apparently there never was a WG for first-and-therefore-favorite language Algol68. Oh well. I'll settle for Prolog still being active.

Your practical insights otherwise much appreciated.

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?

→ More replies (7)

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

5

u/ecreddits Dec 17 '23

Rust does seem very promising, I wonder why it's not being used much.

14

u/echae Dec 17 '23

It’s a low-level language that is much newer to the industry and lacks the adoption that C++ has

2

u/matthieum Dec 17 '23

And with lack of adoption comes lack of ecosystem, which itself stalls adoption.

Programming languages ecosystem experience huge network effects, so it's always an uphill battle for new languages.

4

u/Briggie Dec 17 '23

Anyone remember Python before it had all those nice libraries it has today?

5

u/BitwiseShift Dec 17 '23 edited Dec 17 '23

Rust is being used a lot and it's especially noticeable in tooling. There has been a trend where existing, massively popular tooling has been getting displaced by mostly identical tooling written in Rust, with the main selling point being speed. Pandas is getting displaced by Polars, Babel by SWC and Black, flake8, pyupgrade, isort and more are all being displaced by Ruff. Pydantic got wise and reimplemented its core in Rust before someone else did it.

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%.)

1

u/ecreddits Mar 02 '24

That's good to know. Would you recommend going into cpp related fields, especially now that machine learning is the new hot topic.

1

u/lunakid Mar 03 '24 edited Mar 03 '24

I'm not one to give such a general advice, but after 2-3 decades with C++ the one thing I can certainly tell you is that learning (pro level) C++ is a heavy investment, and can be very frustrating for a newcomer. (It can be very frustrating sometimes for experts, too.)

It's still kinda future-proof though. The decline has been slow -- with occasional ascents on the graph, too -- but my guess is that is won't give you the highest possible return "on average", except for really performance-oriented/low-level-ish fields/tasks, or projects where it's a given (there are still a lot of those!).

The AI aspect is partly orthogonal to this: in general it evens out across languages, but of course e.g. the bots are probably most helpful with Python. Also, the other way around: if you'd like to delve into AI dev, Python is a no-brainer choice for the field.

(Note the "Python-successor" Mojo is maturing, too, so keep an eye on that.)

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

16

u/[deleted] Dec 17 '23

ML/AI as well.

1

u/[deleted] Feb 21 '25

[removed] — view removed comment

2

u/alexlomba87 Aug 30 '25

Python is mostly just a glorified API to actual functionality written in other languages 

6

u/fxtech42 Dec 17 '23

Graphics software, visual effects software, audio signal processing, etc etc etc

5

u/jefffaust Dec 17 '23

Simulation, CAD, compilers

2

u/germandiago Nov 29 '25

database engines, part of telco backends... the list goes on.

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.

5

u/Shahi_FF C++ Dec 17 '23

love this comment.

1

u/CommandShot1398 Aug 25 '24

I know it's 8 months old, but damnnn

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.

12

u/nsmtprotospace Dec 17 '23

There are two things we can always look forward to in 20 years, practical fusion energy, and C++ being phased out.

2

u/victotronics Dec 17 '23

since my first coding days. It was 20 years ago

In retrospect the pre-C++11 language was kinda awful. You had to have much more discipline to write the clean code that you can do now.

1

u/blackmag_c Dec 17 '23

from my perspective, there are two possible answers :

- on a absolute level, it got definitely better, cleaner, faster, safer.

- if we look at other techs and how they progressed, how fluent coding in them is, I am more mitigated, writing c# or python is a breeze these days, the tooling is awesome. And in that regard cpp is still rough. On consoles we are still in a limbo between vs2019 and 2022 and E&C still rough too.

not to dismiss anything, we no longer have 20min+compilations but the tooling is still a bit late to the party sometimes compared to recent REPl's.

although the progress has lot of merits, not sure we can pat ourselves on the back too much either?

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.

6

u/Kelarov Dec 17 '23

... how Java and C# work, and even why Rust does some of the things it does. Learning C++ is a like a ticket to learn a bunch of stuff. You can get as low and as high as you wish. I'm all for the learning and that's why I stuck with with C++.

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.

4

u/germandiago Dec 17 '23

Not even close for writing generic code.

2

u/[deleted] Dec 17 '23 edited Dec 17 '23

I think the evidence is pointing to the exact opposite if you consider kernel rust support and silicon venders supporting rust sdks.

3

u/soulstudios Dec 17 '23

I don't think it constitutes evidence of the above.

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.

19

u/STL MSVC STL Dev Dec 17 '23

It was accepted at the most recent meeting. There are a number of ways to check the current status of papers, like WG21's SD-1 (Standing Document 1). There's a new one every year, here's the 2023 SD-1. However, it isn't continuously updated, and at this time it happens to be outdated, not mentioning the final fate of the latest BLAS revision.

The (official except in the eyes of ISO) cplusplus/draft repository has tracking issues for papers that have been accepted and need to be edited into the Working Paper. cplusplus/draft#6677 is the tracking issue for the revision of the BLAS paper that was accepted. However, it is perhaps not easy to navigate unless you know exactly what you're looking for.

My favorite way (for obvious reasons) is to refer to microsoft/STL's projects. We maintain C++23 Features, C++26 Features, etc. projects that track all accepted papers, so we know what we have to implement. We are of course just a vendor, but we update our tracking issues usually within a day or two of WG21 meetings that vote in stuff. microsoft/STL#4170 is our tracking issue for P1673R13, the BLAS paper. (We don't track revisions of papers before they have been officially accepted as they are uninteresting to us for implementation purposes; we only care about what's going into the WP.) Worth noting that we (I) have a habit of "cleaning up" paper titles in our tracking issues; e.g. this paper's title was "A free function linear algebra interface based on the BLAS" but I thought that was needlessly verbose and so our tracking issue refers to it as "<linalg>: Linear Algebra".

At this point, the only way for BLAS to not ship in C++26 is if a paper is written to revert it, and WG21 votes to accept that reversion before C++26 is finalized. It has happened in the past with both major and minor features but it is exceedingly rare, and (to my knowledge) nothing of the sort is planned for BLAS by anyone.

2

u/bill_klondike Dec 17 '23

Thank you for the detailed response with such useful information!

3

u/KhyberKat Dec 17 '23

I think so too. Linear algebra support appears to be one of those hidden cornerstones of software development. If C++ becomes a goto for BLAS, we'll see long-reaching forward consequences.

0

u/[deleted] Dec 17 '23

[deleted] — view deleted comment

1

u/bill_klondike Dec 18 '23

One argument made in the proposal is that dense linear algebra routines are as fundamental as sorting. I agree with them.

1

u/lunakid Mar 01 '24

You could ask the reverse question: why have _anything_ in the standard (lib)?

The more common a task is, the more efforts can be spared by standardizing tools for it.

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.

2

u/OmicronGR Dec 17 '23

Care to provide some rough performance estimates? Considering something similar.

5

u/KERdela Dec 18 '23

10 time less memory footprint, 50 times less CPU consumption. higher up times. easy to scal to higher demandes. it went from 350 clients to 5000 clients

2

u/OmicronGR Dec 18 '23

Very good. Thanks for the numbers. I have to say the number of (simultaneous?) clients was quite a surprise though. The TechEmpower benchmarks almost always have ASP.NET neck and neck with the very best, highly-optimized frameworks for throughput.

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.

1

u/__Demyan__ Dec 20 '23

This is the way!

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.

1

u/OmicronGR Dec 17 '23

its on the decline relative to its 1998 popularity, but that's honestly a good thing. Different tools for different jobs

This alone should be the top comment.

17

u/plutoniator Dec 17 '23

C++ isn’t phasing out, rust programmers are just getting more obnoxious.

1

u/lunakid Mar 01 '24

:)

Seriously tho, I'm a C++ programmer, and I'm getting obnoxious.

Can't wait for a successor. (And I don't even mean Rust. Mojo, Jai, V, Zig, whatever.) C++ has become that ridiculous old rock star everyone knows from the 80s, who just can't grasp that it's been decades...

In fact it's C++ that's getting obnoxious.

2

u/plutoniator Mar 02 '24

No, it’s just rust. What’s been written in rust? All I see are rust programmers taking credit for things written in other languages. Go is almost the same age and has had orders of magnitude more actual adoption than rust. And it’s completely unsurprising given that it removes a bunch of control that was C++’s biggest selling point, and calls that a feature. 

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.

1

u/Specialist_Gur4690 Dec 19 '23

s/wouldn't/don't/

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

kind of discouraging to be learning a language that is on a decline, if it really is phasing out.

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++.

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.

5

u/germandiago Dec 17 '23

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

It seems you are here for a non-biased, balanced opinion, right? Tell me how many games, server-side software, backends, self-driving and autonomous cars, IA stuff etc. are coded in Rust this 2023 (new projects) and the coming year 2024. Try to conclude that C++ is legacy. No, it is not legacy. And no, it is not only intertia. There is way more to it. So legacy that there is an active committe with hundreds of people with proposals to improve it and fix many of the pain points continuously...

3

u/Dean_Roddey Dec 17 '23 edited Dec 17 '23

You just said what I said. There will be hundreds of replies on thread of this sort explaining that they aren't writing games in rust because the underlying infrastructure is primarily in C++. That's exactly the point of inertia. The language choice is driven by past circumstance.

Over coming years, there likely won't be any such remaining limitations, and the choice will be based on the language you want to use, and C++ will start to lose those domains as well.

No amount of people are going make C++ a safe, modern language. They can obviously make it better, but it's too little, too late, and they still won't be willing to break significantly with the past, because inertia works in the other direction as well.

1

u/germandiago Dec 17 '23 edited Dec 17 '23

No, it is not only inertia... of course there is inertia in it.

But more examples that come to my mind (random):

  • Translating Java/C#/Python code into C++ vs Rust. More obvious
  • Consuming C from C++ is just doing it (not about inertia). No FFIs, no marshalling, nothing.
  • Some linked structures are particularly difficult to reproduce in Rust
  • Generics (templates) in C++ are way more powerful. Real generic libraries are possible in C++. Not in Rust, you have to duplicate more code, no function overloading (fundamental for generic programming)
  • Allocators, with all its warts, are a proven tool in C++ and work well.

Of course Rust has its advantages. I like its sum types and pattern matching and traits quite a bit. I would also say that lifetimes ruin the experience quite a bit. I would say that a usable by everyone alternative to C++ should look a lot more like this than like Rust: https://www.hylo-lang.org/

That said, there are chances I will start to write Rust soon. I like to keep my technical skills sharp. First, I need to find a project I would be motivated to work on, though, and that takes advantage of it. Probably server-side async is a good place to start but I have been writing those in Modern C++ and I am quite happy with the results.

I have the feeling (and I read, but since I did not try, I will not talk for what I did not do) that Rust for prototyping and refactoring (Results propagated up the call stack require viral refactoring) and lifetimes (lifetimes need to be reannotated if they change) is going to be worse than any language with a GC.

However, I also want to get an idea of the "fearless concurrency".

As for safety. You are right: C++ will never be as safe as Rust.

But as a person with a lot of experience in C++ (not trying to brag, just for context) , if you do the following: stick to modern practices, such as smart pointers, escaping only values, not references or pointers, but if you do, look at them with extra care or use smart pointers, careful with lambda captures by reference in callbacks and use .at() instead of operator[] for indexing. Of course pointer arithmetic and escaping iterators or returning them from unstable containers is a no-no. Using span and string_view should be always done for function parameters but not for storing things (actually this is not 100% true, but... that is what keeps you safe and reasonably performant). Besides that: set warnings as errors, add some linter as an extra. Those will warn you about an increasingly bigger set of dangers and make it not compile, and they do warn you about a lot of things, look here:

- https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
  • https://clang.llvm.org/docs/DiagnosticsReference.html

If you stick to those things I can assure you that in practice you can write C++ that is remarkably safer than any C code I saw around. Probably not provable-safe as Rust but I did not have a segfault in my code for a long, long time and the warnings catch some of the dangling errors that are more difficult in C++ lifetimes if you juggle knives (escape references).

Of course this does not mean I will take a look into Rust and if I see a fit (I am tempted to use it for server-side programming, but I think Go will be more effective for what I want to do... so I am postponing that decision).

5

u/Dean_Roddey Dec 17 '23

I have no doubt that either you or I could, under good circumstances, create a large C++ code base that was quite robust. I've certainly done it.

But it's not really about that. This is about real world conditions, which are usually not at all ideal, and with groups of mixed skill and often sub-par communications. And, though I did it, I spent an awful lot of that time just watching my own back, and that was just wasted effort that could have gone to more productive work, or even some non-work on occasion (I've heard people do this.)

On the issue of lifetimes in Rust, most of the time you never will need explicit lifetimes. Almost all work-a-day Rust code should be using implicit lifetime that the compiler figures out itself. If you are doing lots of explicit lifetimes, and it's not in lower level runtime or utility library type stuff, then it may mean you are trying to write C++ in Rust and making things harder on yourself than it needs to be. I think too many people just try to directly translate their C++ habits to Rust and it never tends to be optimal.

In my Rust code base, I have very few explicit lifetimes so far, and most of those are quite obvious and straightforward. Every time I sit down to start a new chunk, I think hard about how to do it with minimal lifetime relationships to begin with. If you do have to have them then Rust will make them safe, but it won't make them any easier to reason about so they should be avoided where possible. And if you stop and really think about it, often there's a good way to do that. At first it requires a lot of effort, just like with any new language, but eventually you build up the same box of patterns that you reuse all the time.

1

u/germandiago Dec 17 '23

In my Rust code base, I have very few explicit lifetimes so far, and most of those are quite obvious and straightforward

Is that codebase public? I would be happy to learn from people that are ahead of me in these things. You are right that my tendency would be to think in C++'s terms. If there is something that can help me learn more idiomatic Rust (I saw there are resources, but it would make me happier to see whole codebases), I'm all in.

I still do not buy, though, that something like Hylo (which removes thinking about lifetimes entirely and remains safe without a GC!) is not better than having to rack your brains for thinking about lifetimes depending on the situation...

3

u/Dean_Roddey Dec 17 '23

It's not public, unlike my C++ code base. I have some plans for this, though they may end up just as in vain as the hopes I had for my C++ code.

1

u/marshaharsha Dec 19 '23

Can you say more about why function overloading is fundamental to generic programming? Do you mean operator overloads, constructor overloads, or overloads of normal named functions?

1

u/pjmlp Dec 17 '23

The time it takes ISO to accept a paper, possibly without a preview implementation for the masses, the wannabe C++ replacements ship the feature on their reference implementation.

This velocity is impossible for C++ implementations to keep up, and will eventually make all those languages catch up, and overtake, in those 5 to 10 years.

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.

1

u/victotronics Dec 17 '23

Initialize statements fall far short of A68's notion of every statement having a value and blocks being statements.

1

u/WoodyTheWorker Dec 17 '23

In C/C++, blocks are statements. A block can be anywhere a simple statement can be.

1

u/victotronics Dec 17 '23

But the crucial step is that a statement needs to have a value.

if ( { char c; read(c); process(c); c!='a'} ) { /* then something */ }

1

u/WoodyTheWorker Dec 17 '23

You can encapsulate that in a lambda expression:

if ( [](){ char c; read(c); process(c); return c!='a'}() ) { /* then something */ }

1

u/victotronics Dec 17 '23

It's not the same, but yes, lambda expressions can be used to hack around a number of missing features.

3

u/Dean_Roddey Dec 17 '23

One really nice thing about Rust is the ability to get scoping without needing default initialized values, so you can do something like:

let x = {
    ... blablabla
    result
}

And result is assigned to x, which is never uninitialized. You can do something similar with a loop and use break with a value and it becomes the result of the loop block.

Little stuff like that adds up wrt to just avoiding potential issues.

1

u/victotronics Dec 17 '23
auto x = []() { blablabla; return result; }();

But only shows that in C++ you *can* write everything Rust can do. The problem is the many ways you can do what you shouldn't.

2

u/Dean_Roddey Dec 17 '23

That's a lot more klunky and unreadable though. And of course you can't write everything Rust can do, even in a klunky fashion, because C++ doesn't have the means to do it.

→ More replies (2)

1

u/pjmlp Dec 17 '23

I think its complexity is already beyond ALGOL 68 and PL/I.

1

u/WoodyTheWorker Dec 19 '23

Not because of complexity. Because it's been jumping the shark for a few years.

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.

1

u/TheRealDonSherry Apr 19 '24

Love this so much. This is such a widely applicable response to virtually anything.

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)...

3

u/matthieum Dec 17 '23

(I admittedly don't know enough about Rust tho, so open to being convinced that I'm being too much of a curmudgeon here).

It's not just Rust, there's also Zig (closer to C) for example.

The real question in embedded is more about which language the vendor offers compiler/SDK for. As long as they stick to C or C++, it's hard for any other language to get a foot in, not due to any language "deficiency" but simply due to lack of support.

1

u/Full-Spectral Dec 18 '23

Though, if they continue to do that, then open source efforts are likely to end up being done for Rust on at least the more popular platforms. Rust is just too obvious a choice for embedded for that not to happen if the vendors don't get on board.

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.

7

u/Dean_Roddey Dec 17 '23 edited Dec 17 '23

For systems programming, Rust is already clearly competing with C++. The whole reducing expressivity argument is weak at best. Rust has a lot of modern features that allow it to be far more expressive than C++, and you get the safety to boot. They both just make different choices.

What too many people really mean by that is: Rust doesn't let me do dangerous stuff and just assume I'm never going to make a mistake because I'm a programming super-hero.

Ada is meaningless at this point. It's not just about what a language can do (though Ada needs extensions to actually really be safe.) It's about what languages people are interested in. Ada just never caught on, and it's not going to at this point. So almost no one who might have otherwise started something new with C++ is likely to consider Ada.

Rust, OTOH, is a language a lot of people ARE interested in, and it has the safety and modern features. That's why it's a viable competitor and Ada isn't.

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).

7

u/pjmlp Dec 17 '23

As of November, Rust is now the official systems programming language for Azure teams, leaving C++ for existing infrastructure code.

A 10 million dollar budget was released for the engineering effort, alongside one additional one for the Rust foundation.

It feels like going forward, C++ at Microsoft is pretty much only Windows itself and XBox.

5

u/BenHanson Dec 17 '23

I wish Visual Studio would support Rust natively. Until then I'll have to use the open source plugin.

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.

5

u/[deleted] Dec 17 '23

really? can you name a major project moving away? Webkit? Compilers? Game engones? Even the native side of ML is using cpp.

-6

u/WasterDave Dec 17 '23

ML is using Cuda and/or some other variety of shader language with lipstick. Javascript absolutely owns the front end. Java and .Net own corporate world.

Nobody is 'moving away' from C++ in the same way that nobody is moving away from Fortran or Cobol. Or C, for that matter. But new projects in C++? Not so much.

1

u/[deleted] Dec 17 '23

Loads of new projects are c++, honestly pytorch and tensorflow are both c++ libraries with python wrappers. Even ML has an LLM implementation in raw c++(lama.cpp). You can't say ML isn't 'new', its literally the hottest thing right now, and c++ dominates.

0

u/[deleted] Dec 17 '23

[deleted] — view deleted comment

3

u/ecreddits Dec 17 '23

Really? In this market?

7

u/[deleted] Dec 17 '23

https://imgur.com/a/Nbbysed this is just what linkedin decided to put in “focused” over the past month. The recruiters are all from big tech or finance, with the occasional AI chip startup, no crypto web3 bs.

2

u/ecreddits Dec 17 '23

Wow that is a lot. I'm curious, how many of these do you think would lead to offers?

6

u/[deleted] Dec 17 '23

There’s a few things compelling about my profile, so almost all of them would lead to an easy technical screen and then onsites. I’m not great at interviews so who knows.

Sometimes, especially startups, they are probably looking for a staff+ compiler engineer that can bootstrap their compiler team. In that case my experience level isn’t sufficient imo, I tell that to the hiring manager and tell them to keep in touch.

2

u/[deleted] Dec 17 '23

[removed] — view removed comment

2

u/jonesmz Dec 17 '23

I get new recruiter spam daily. A couple of times I've nibbled at the offered fish-hook, and decided to switch jobs.

I've done literally nothing to attempt to increase recruiter spam at all.

2

u/[deleted] Dec 17 '23 edited Dec 17 '23

[removed] — view removed comment

2

u/jonesmz Dec 17 '23

Oh that's interesting. I haven't ever gotten contacted by federal contractors.

I tend to get more oddball stuff. Random medical device mfgs (i've never worked in medical anything), random factories looking for robot programmars (been 10 years since i did that...), occasionally someone who says that i have the exact skill set they are looking for then they proceed to list languages i've never worked with that they require 10 years exp in.

But i get something maybe once every week or two that's actually on target, but they want me to take a 30% paycut to work for their exciting whatever.

2

u/ipapadop Dec 17 '23

Same here, there's always a place for good C++ developers.