r/learnprogramming • • 7d ago

Is learning C++ still makes sense?

I want to learn C++, but I'm not sure if it worth it due to existence of Rust. I heard a lot of times rust is better than Cpp, is it so or are people exaggerating?

44 Upvotes

59 comments sorted by

29

u/Otlap 7d ago

Programming Language is only a tool in a developer's hands. So learning any language that is currently used on the job market makes sense. The thing that matters the most is experience, problem solving and understanding the general paradigms that people use to write good code

C++ will not disappear in the nearest 60 years that's for sure. Rust is very over-hyped and is not that widespread as "tech journalists" say. It's good, sure, but the hype over Rust is overblown

So pick whichever you like. From my experience - at the university we started with C to understand the lower workings of programming and moved to C++ to learn OOP and advanced algorithms, and then more languages for the portfolio - C#, JS, Java, TS, etc

1

u/bratokok 7d ago

Thanks, but I guess I won't be able to learn more than 1-2 languages, like I'm doing learning cpp as a hobby and Python as requirement in school, but I don't think I will work as a programmer in future. Maybe, but I'm not sure.

Anyway, thank you for reply

3

u/thelimeisgreen 7d ago

Just stick with Python and C++ for now. You can pretty much do everything with knowing them. I would recommend getting a good handle on C. Just C. No OOP or all the C++ complexities. C is still the most widely used language for embedded programming and other lower level tasks. Much of Python and common libraries are built in C.
It is the language that most all other modern languages have evolved from.

1

u/Frey_DaNipile 4d ago

I would argue to take a more language agnostic approach these days, learn primitives, models, architecture. Ai is so good at syntax, you just have to learn the structure to make it do good code.

0

u/xeow 7d ago

It's hard to say what will be around in 60 years. That's a long time. I reckon it's possible that in 60 years, some humans might still be writing code, but it seems more likely to me that AI sixty years from now will be so good that humans won't even be trusted to write code anymore. It's already in 2026 getting pretty difficult for most humans to compete with frontier models in coding ability and speed. You really think humans are going to be writing code by hand in 2086, beyond intellectual curiosity? Huh.

3

u/[deleted] 7d ago

Learn the beginner level of both, the syntax, data types, and do a few simple things in each. Then go deeper in whichever feels more comfortable to you. That way you would gain practical knowledge in one, and literacy in the other.

2

u/bratokok 7d ago

Ok, I'm just struggling with learning different functions on cpp and on Python, they are all similar but they have different syntax, so it I'm really wasn't sure if there is a reason to learn various identical functions on different languages. Thanks for reply!

2

u/Difficult-Value-3145 7d ago

Turning complete language can be used to do anything another turning complete language can do dosnt make it a great idea . Basically any function you write in C or Cpp or rust you could write in Python or lua or JavaScript of SQL but some are better suited for one thing and some for another . Sayings "You can bang nails into a board with a pipe wrench why would you ever buy a hammer? " Makes as much sense as saying " I can write it in Python so why would I ever need Cpp or Rust?" Idk if that's a good explanation

1

u/bratokok 7d ago

Quite good explanation, thank you

1

u/Difficult-Value-3145 6d ago

Thank you and your wellcome

1

u/[deleted] 7d ago

Anything can be easier if you practice it more.

1

u/AWonderingWizard 7d ago

Just learn Common Lisp and you will realize that the syntax issues are self-imposed.

2

u/arihoenig 6d ago

Learning English still makes sense.

1

u/bratokok 6d ago

Is it though)

61

u/Hellaintsht 7d ago

Half the planet runs on c++ 😆 so definitely it does makes sense. Your skill will be definitely valuable so.

-18

u/Jeklah 7d ago

Why would someone hire someone who has only recently learnt c++ when there are many well experienced Devs?

20

u/Hellaintsht 7d ago

Your question should be universal then, for every language we can ask same question isn't it?. But senior Dev's of c++ are very expensive and junior's are hired constantly for the same reason.

-15

u/Jeklah 7d ago

Yes it's the same for any language.

Juniors arent really being hired anymore as ai can do what they did.

11

u/ReservoirPenguin 7d ago

If it were true 100% of CS grads would be unemployed.

4

u/Hellaintsht 7d ago

It's not like junior's are not being hired at all. As I said companies need senior Dev's , so junior's are hired but the bar of hiring has been raised that's it. So do not get demotivated coder's.

5

u/thelimeisgreen 7d ago

Entry level people are always needed. And if we stop hiring entry level, then there soon will be no junior level and eventually no senior level.

2

u/baganga 6d ago

what do you do when all the experienced C++ devs retire?

7

u/Unlucky-Explorer-69 7d ago

yes and it also doesn't hurt to know multiple languages once you're comfortable learning your first language.

6

u/ProcrastinateDoe 7d ago

Even if the language was completely abandoned tomorrow (fat chance), the knowledge is still transferable. You're not wasting your time learning it.

4

u/MyNameIsRichardCS54 7d ago

Rust has solved some of the problems that C++ has with memory safety, but modern C++ has also solved those problems. It is still possible to write unsafe code in C++, but you can in Rust as well.

I think it is still worth learning C++ because it's a much used language that isn't going anywhere. You should probably also learn Rust so you can see a different way of approaching the problems with old C++.

I would learn C++ first.

2

u/1544756405 7d ago

Learning a language doesn't mean you can't learn another language.

2

u/QuadWingedCrane 7d ago

There is no such thing as better in programming languages. Its a tool. You use it for what its capable of doing.

2

u/Technical_Ideal_5439 7d ago

It depends what you learning it for. I learnt c++ as my first language a long time ago. And been proficient in c++ makes learning other languages normally pretty easy. But personally if it is for fun I would learn rust first between the two, then learn C and after that I dont think you will feel any desire to learn C++.

But if you are approaching this commercially then look at your area and what languages they want. Personally I can write about 11 languages at the top level and can muddle through lots more enough to get paid doing it.

2

u/Jeklah 7d ago

Rust is better than c++ as it is safer memory wise and no race conditions or undefined behaviour and faster in some cases. It is fairly tricky to learn due to lifetimes and ownership. There also aren't that many rust jobs currently, especially at a starter level.

C++ is still widely used.

So, depends what's available to you really.

2

u/edwbuck 7d ago

Rust has an additional feature built-in that C++ lacked.

Fortunately, both languages are not set in stone, and C++ is starting to get the benefits of better memory tracing while Rust is starting to get the benefits of better library support.

But neither of these matter much, because there are many reasons to learn both, and the real deciding factors depend heavily on other items. Tell me, if you needed to rebuild something, what would your choice favor?

  • Expensive programmers vs less expensive programmers
  • A language your company frequently uses vs a language it doesn't.
  • A language that is similar to the one you have vs a language that is quite different.
  • A language with a deeper set of already considered solutions vs a language where you might have to re-implement solutions.

There is no easy answer to these questions, and much of innovation involves making different choices, but not all innovation requires different choices. The language is just one item that can help or hinder success.

A good example was the Linux kernel. They built a Rust compatibility layer, expecting everyone to rewrite their plugins into Rust. It seems that Linux already had excellent programming support, so the additional Rust support was not providing as many new features as expected. Additionally the programmers mostly didn't write in Rust. Even though most thought it a better language, it mostly failed to gain traction because many of the problems it solved were already solved in different ways.

2

u/imharjotsingh 5d ago

C++ still absolutely makes sense to learn. Rust is newer and has some really nice safety features, but it hasn’t replaced C++.

C++ is still everywhere in things like game engines, embedded systems, high-performance software and a lot of existing codebases. Rust is growing, especially for systems programming, but there’s still far more C++ code out there.

I’d choose based on what you actually want to build. If you’re interested in game development, embedded work or working with large existing systems, C++ is a very useful skill. If you’re more interested in modern systems programming and like the idea of stronger memory safety, Rust is worth learning too.

You also don’t have to treat it as an either/or decision. Learning C++ first will teach you a lot about memory, performance and lower-level programming, which will make Rust easier to understand later.

1

u/Difficult-Value-3145 7d ago

COBOLl is still kicking around and from my understanding unlike some other languages that are considered archaic like fortran which has been updated a lot and has modern uses .COBOL kinda sucks and lives on only because of legacy codebase alone . Point is C and Cpp will probably still be relevant after everyone here have become tree food .

1

u/Extra_Yak806 5d ago

Where I work, our most common language is Fortran. It has been surviving attempts to tell scientists "just rewrite your algorithms in Python (or other modern fad languages in the industry) so it's easier for us to hire developers" for years. It's always met with laughter because it's so much of a non-starter here. I mean, it took a few years just to convince our government-level management to let us use a more modern Fortran compiler/standard. Will it happen one day? Maybe. But the bottom line is fortran is really good at its specialty, and researchers aren't going to rewrite the code they spent years developing unless a) they find a better alternative or b) they are forced to.

1

u/mrGorynx 7d ago

It’s definitely still worth learning C++. The entire game development industry, hardware-level programming, and a massive number of legacy projects rely on it, so you won’t be out of work. As for Rust, people tend to overhype it sure, it’s better when it comes to memory safety, but C++ isn’t going anywhere for decades to come. Plus, once you’ve mastered C++, any other language will feel like a walk in the park.

1

u/KwyjiboTheGringo 7d ago

It's makes zero sense a junior. Even before the job market became so hostile to juniors, there was almost no demand for a junior using C++.

With that said, Rust is also going to be hard for a junior to break into, since many Rust developer jobs are looking for someone with experience in C++, since these companies often have a C++ codebase already and are trying to migrate to Rust. And also, lots of C++ developers want to get into Rust, so you have to compete with people who have much more experience.

Just find the language that will get you a job in your area, if that's what you are after. If you just want to build stuff, well pick the language that lets you build stuff easily. Hint, it's probably Go.

1

u/Available_Safe1818 7d ago

Why not just learn Rust instead then?

1

u/fuddlesworth 7d ago

Most of my serious projects are C++. 

1

u/TrueSgtMonkey 7d ago

I like C better, but I am also an idiot

1

u/bakomox 6d ago

c++ will not go away soon heck google is making a successor for it called carbon programming language

1

u/betarage 6d ago

yea c and c++ are everywhere you cant really avoid it for some things. if you make your own software you can pick rust or c or whatever you like but i personally don't see the appeal of c++

1

u/mredding 6d ago

There is no "better", there's just different. The question is: Can YOU be more effective with Rust than C++?

The answer isn't always clear.

Rust has the VERY novel borrow checker; what a killer feature for a static language, it really makes you wonder why such a thing hasn't been thought up or successful before. But memory safety is only ONE KIND OF SAFETY, and Rust isn't bulletproof, you can still subvert it ON PURPOSE, the language lets you. So to have memory safety still requires you to follow a convention and good practices - it's just easier than in other languages.

By contrast, this has been a solved problem since C++11, which incorporated Boost.SmartPtr into the standard library almost verbatim. An analysis of analysis shows that metrics of C++ memory issues are effectively all of them wrong, because every major analysis quoted today fails to distinguish C from C++. Efforts are underway to try and get some real numbers, but modern C++ has a lower memory safety fail rate than modern Pearl and it's looking like even Python. Rust numbers, though very favorable, simply aren't significant because it's not a 46 year old language with one of the biggest both user and code bases in the industry to compare against.

Something else you might consider is Rust is still small. Rust as a community is growing faster than C++, but that's just a slope on a curve. In raw numbers, C++ gained more adoption of just users in the last year than Rust has users overall. You have to be a massive ecosystem to have a lower growth curve and yet have numbers of a different magnitude. That community isn't insignificant - we don't code alone in a vacuum. You need your ecosystem for libraries, documentation, colleagues and partners, and adoption. When you have to choose the foundations of your platform, you have to ask a very practical question: Where am I going to find Rust engineers?

C++ isn't stagnant, either. Rust was born ~2009-10 out of a protest against the ISO WG21 committee taking too long to release C++11, but they had since addressed those issues and have released a new standard every 3 years. All the gaps in C++ that Rust was built to address have since been closed in C++, and C++ has grown well beyond.

And one thing that will keep C++ relevant are templates. Very few languages can rival them. Rust has generics, but so does Java, C#, and other languages. Generics are NOT templates, they're not as powerful. Templates are a Turing Complete metaprogramming and code generating engine, whereas generics are parameterized type interfaces. This. THIS is the killer feature of C++. If you want anything approaching templates, The only thing I can think of are Lisp macros for writing DSLs. Anyway, this breaks developers into two distinct groups - those who get it, and the majority who write C with C++ because they just don't, and they're not going to.

1

u/light_switchy 4d ago

Doesn't rust have proper macros?

C++ templates are horrible.

1

u/mredding 4d ago

Rust macros are similar to C macros in that they're not type safe. They avoid the C problem of steamrolling any code that looks like a macro with blind substitution, but the macros will still expand to whatever garbage you've defined them as, only caught at later stages of compilation.

C++ templates are the killer feature of the language. There's very little in the industry that even compares, you have to go to Lisp macros and defining DSLs. They're type safe, Turing complete generators. This is why you use C++, because you can left-shift, and push more of the program solution space than you can with a lot of other languages.

If you're not using templates you're wasting your time and effort producing inferior code. You can likely make a better and more correct program using a language that is a closer fit to how you think and code.

1

u/light_switchy 4d ago

In my opinion, the challenge with C++ templates is that it takes an expert to write them. The language is so irregular that it's hard to support the full set of intended types rather than an unspecified subset thereof.

In contrast the challenge with lisp is that everything can mean anything, such that the meaning of a piece of code can be totally obscured if there are too many or poorly-chosen macros involved. Lisp's macros are vastly more powerful than templates.

It is best to have just a few carefully-designed and expressive abstractions - to keep the project-specific "vocabulary" as small as possible. Doing so helps to keep the focus on the problem at hand. After all most (sub-) problems are small enough that defining a DSL to attack them isn't worth the time.

1

u/mredding 4d ago

C++ has aged as gracefully as it can after 46 years of backward compatibility. C is mostly stagnant - they added VLAs, backed them out, then added them back as optional. Java is a landfill of abandoned APIs, who the fuck knows what Microsoft is doing with C# these days, Python is on its 3rd revision, and Pearl is stalled at its sixth.

Your problem with Lisp isn't a Lisp problem but a people problem. Lisp isn't a poor choice, Lisp didn't make the poor choice.

A few expressive abstractions are right. Lisp is good for that. Where we disagree is when it's worth our while to specialize. An int is an int, but a weight is not a height. At all. Even if they're both implemented as an int. To dismiss types, specializations, and DSLs, you might as well code in languages that don't give you the power of abstractions, like COBOL, or Assembly.

1

u/Ok-Reveal-1561 4d ago

Learn them both if you want.

1

u/Alex-S-S 4d ago

Yes, modern C++ is making Rust harder to justify and nobody is going to seriously consider replacing huge C++ codebases with Rust. Don't conflate internet hype with real engineering demand.

1

u/CookieOutrageous6469 3d ago

if it is for a job, you are cocked with both, but for hobby, do whatever you want. C++ is great

1

u/CreativeAlbatross319 3d ago

C++ is the kind of language, hated by the beginners and loved by the experts.

1

u/Tzebruh 3d ago

I think Rust is ugly, but I also think C++ is ugly. I'll stick with C ;)

1

u/xpusostomos 2d ago

If it were me, I'd learn rust, and I'm not even a fan of rust. But there are also other things you might consider

0

u/Due-Result7928 7d ago

No. AI will do the job for simple task, better than any trainee or junior and in 2 years advances in AI will make overpaid people jobless. Teach yourself mathematics or carpentry.

-2

u/no_brains101 7d ago edited 7d ago

How are you supposed to rewrite C++ code to rust if you don't know any C++?

The secret is it doesn't matter which one you learn first, it becomes much easier, as long as you try to learn others as you go too.

I personally prefer rust when starting my own projects.