Live data from Hacker News

Ask HN: Learn C++11 or Rust in 2022?

news.ycombinator.com

91–100 of 161 posts

Re: Ask HN: Learn C++11 or Rust in 2022?

#91
I'd say C++ at this point in time. It's getting better by the day, yet it has decades of high quality projects and libs you can rely on. Each new version is better than the last. It may be irritating that few things are ever hard-deprecated, and you have to keep a list of current best practices. On the other hand, concepts, ranges, previously auto and constexpr, are all godsend and make for an expressive language that's still very powerful.

With Rust, depending on what you're working on, you may lose almost no time integrating C and C++ (with an extern C interface) libraries, or you may lose 50% of it. Sure, you don't have to know CMake at least (which is a hard requirement for C++ nowadays), but using any extraordinary library dependency in Rust may prove to be a nightmare. Essentially: if someone else didn't already package it, prepare to lose some serious time. The language is nice, but the ecosystem is immature.

Things are probably going to change, and Rust will become more viable over time, but C++ is also improving at a rapid pace so I guess Rust will never completely outcompete it.

Re: Ask HN: Learn C++11 or Rust in 2022?

#92
post #72
post #44

Not for everybody, and I’m sure it’s not the most efficient way to approach it, but I personally felt that learning modern C++ was a good intermediate step before learning Rust. Going to rust directly has been a very frustrating experience and made me give up. Instead I spent time learning C++, I found out I could more easily transfer my knowledge/skills there. Once you become more proficient with the basics you lear…

One reason C++ experience is so helpful with Rust is because the language was created by C++ programmers for C++ programmers, so most books and even documentation are written from that perspective.

This is something that's completely obvious to me. What I don't understand is why people online insist that Rust is so different and C++ knowledge is useless - I doubt I'd grok it immediately if I didn't understand C++.

Re: Ask HN: Learn C++11 or Rust in 2022?

#93
post #89

I am personally not a fan of learning a language that does a bunch of "magic" behind the scenes for you, and basically tells you that you don't need to understand what is going on behind the scenes. That is the impression I get from Rust. I also have no interest in investing in a language that might no longer be hot in a few years. At least with C or C++ it will be here, until I'm retiring. The volume of software out…

It’s funny because I get the magic impression from c++ but not from rust. Stuff like copy semantics in C++ is so absurd. Rust is explicit and by design not particularly magical.

Re: Ask HN: Learn C++11 or Rust in 2022?

#94
post #90
post #2

Between C++ and Rust, my bet would be that you decide Rust. But—also learn Zig in addition to Rust. Having seen first-hand how so many threat vectors these days are now supply chain attacks, having reported CVEs and earned P1 bounties in memory safe languages, and having worked on static analysis systems to detect zero day exploits—I'm also impressed by Zig's overall approach towards safety, as being more than only m…

see? learn Rust, but yeah, also learn Zig, or whatever new flavor of the day. No thanks. I don't want my tool set to change every year. I got out of web dev exactly for that reason. I'll stick to my C++ or C, thanks.

And your software will continue to have memory safety issues.

Re: Ask HN: Learn C++11 or Rust in 2022?

#95
post #83

For current job availability, C++. For enjoyment (in my case) and potential future jobs (not guaranteed), Rust. C++ is tried and true and it's proven itself for sure. Rust is just more fun to work with for me though. Lots of good tooling and documentation for both as well.

C/C++ have proven themselves impossible to write in a secure manner at any useful scale. The evidence is overwhelming.

Re: Ask HN: Learn C++11 or Rust in 2022?

#96
post #67

Here’s a fun way to decide. Do Raytracing in One Weekend[1] in one of them. Then rewrite it again in the other. That should give you a good sense for which one you want to invest in. Spoiler: I did this exercise myself. I found Rust to be more convenient in some ways. The Rayon crate made adding parallelism (threads) pretty easy. Some other crates made things pretty terminal output easier. C++ feels more familiar to…

I don’t think raytracing is a good test of a languages merits. It tests a fairly narrow part of the scope of a modern language.

Re: Ask HN: Learn C++11 or Rust in 2022?

#97
post #70

I remember when Stroustrup's C++ came out in 1986. I used to be able to cite the Annotated Reference Manual (ARM) by chapter and verse. But if I were a young programmer in 2022 and looking at learning either C++ or Rust I'd choose Rust in a heartbeat. Why? Many reasons. For starters, C++ is 40 years old at this point and embodies software engineering practices from the late 70's to early 80's (for you young folks, st…

Honestly, I think the shift you are already seeing is from C++ -> a GCed language (python, javascript, java). While C/C++ are everywhere, they are mostly in very low level places. You don't find a lot of new backend projects that go the C++ route. Rust will likely eat up a significant chunk of C++'s current market share and SOME of the backend service market share (where CPU and Memory are REALLY important). However,…

If I was in a situation where c++ made sense for a greenfield project, rust would almost certainly be a better choice.

Re: Ask HN: Learn C++11 or Rust in 2022?

#98
post #93
post #89

I am personally not a fan of learning a language that does a bunch of "magic" behind the scenes for you, and basically tells you that you don't need to understand what is going on behind the scenes. That is the impression I get from Rust. I also have no interest in investing in a language that might no longer be hot in a few years. At least with C or C++ it will be here, until I'm retiring. The volume of software out…

It’s funny because I get the magic impression from c++ but not from rust. Stuff like copy semantics in C++ is so absurd. Rust is explicit and by design not particularly magical.

I agree, and let's not even start with operator overloading. Rust on the other hand seems to be a safe but also rather explicit language (a good thing not just for system programming).

Re: Ask HN: Learn C++11 or Rust in 2022?

#99
post #22

C++20 is going to be much friendlier. If you're new to C-like languages though, perhaps start with C and work up to C++. The foundations are important to understand, and you'll appreciate why RAII is important. EDIT: Ah yes, the "crawww C is unsafe, use rust crawww!" downvote crowd is out in full force today.

I use C at work and in the past for hobby projects C++ (11) to do some modifications to Quake 3. Is C++20 support in compilers already? MSVC/GCC/Clang

MSVC has a good amount of C++20 support now https://en.cppreference.com/w/cpp/compiler_support#cpp20.

Re: Ask HN: Learn C++11 or Rust in 2022?

#100
post #70

I remember when Stroustrup's C++ came out in 1986. I used to be able to cite the Annotated Reference Manual (ARM) by chapter and verse. But if I were a young programmer in 2022 and looking at learning either C++ or Rust I'd choose Rust in a heartbeat. Why? Many reasons. For starters, C++ is 40 years old at this point and embodies software engineering practices from the late 70's to early 80's (for you young folks, st…

> would you start a major project today using Cobol? No.

You might not start a project in it, but goddamn I bet you could make a boatload of cash doing consulting work to keep ancient COBOL systems running. Even today that's pretty lucrative business if you have the skills and connections.

Post reply on HN