Live data from Hacker News

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

news.ycombinator.com

41–50 of 161 posts

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

#41
post #11

Unless you're going to be doing something that specifically requires C++ (some game engine related code comes to mind), go with Rust. Most real-world code (by number of codes and lines of code) is something else than C/C++ nowadays, just because of developer velocity and a larger hiring pool. Yes, you can get that last cycle of power from a piece of hardware by going with C or C++, but on the other hand finding peopl…

How do you begin to get paid for it without studying it first?

Get an employer who lets you learn on the job.

Programming languages are like actual languages, after you know the first two or three, the fourth one isn't that much of a hassle (there are exceptions of course).

I didn't know crap about C# when I started my current job, but I did have a decade of Java under my belt. Took me about a day to figure out the basics. Ifs and switches and functions and classes are the same everywhere.

If I would've had to study something like Haskell or Scheme, it would've taken a bit longer.

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

#43
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.

The downvotes are probably because you said "start with C" while the OP has clearly stated they have experience with C and use it in their day job.

P.S. I haven't downvoted you.

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

#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 learn about move, copy, smart punters, ownership, etc.

After some point you start to notice that you are basically doing in your mind exactly what a borrow checker enforce. So that made me curious and I tried rust again, and this time everything made complete sense and the language has been incredibly refreshing to work with.

This intermediate state was very useful for me to build my mental model and develop a better intuition, C++ made it simpler to do it in a more progressive way. And Rust is a fantastic langage if you can wrap your mind around it’s semantic and learn to work with the borrow checker.

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

#45
post #18

I don't understand why someone who has so much open source information, has the intelligence to learn C-level languages, and has a certain experience in the industry, would ask such a question.

Maybe they just want to try to see which way the wind is blowing before making a decision which would require more than a little effort to achieve? I’m actually surprised that the general consensus isn’t rust as that’s the new shiny plus the people saying C++ are giving very valid reasons beyond the usual language dogma arguments that these discussions usually devolve into.

I mostly use C when I need to speed up some bits in our codebase; and I have no chance to ask people really working in C++/Rust which can give help me decide; the people I know use C++ for games or QT. The ones I know that touched Rust gave up after 1.5 weeks.

As you say I wanted to know how's the scene at the moment; I am very disconnected from how they have both evolved and their future (mostly because what I see is hate to C++)

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

#46
post #14

Earlier quoted context omitted.

> I'm confused Thanks, I've tried to clarify that Zig provides spatial memory safety but not temporal memory safety, so hopefully it's less confusing. > "Simplicity" does not mean safety. Ceteris parabus, complexity breeds bugs and simplicity improves the probability of safety. For example, if I were auditing a piece of code for security, I would prefer the simplest correct program to the most complex correct program…

> Reduced surface area means reduced area for attack. First of all, that's security , not safety . Lots of software exists in an environment where it isn't going to be attacked. > Things like checked arithmetic matter and should be enabled by default in safe builds. Rust offers actual checked arithmetic - for example, suppose I have a 32-bit signed integer (i32) and I want to add something to it, in Rust I can choose…

> First of all, that's security, not safety. Lots of software exists in an environment where it isn't going to be attacked.

I use the terms interchangeably on purpose, because safety and security are really two sides of the same coin. In the past, I've worked in security and I now work in a domain where safety is critical. It's my experience that the two fields have considerable overlap.

We can always get better at interdisciplinary sharing of knowledge.

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

#47
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

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

#48
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

Not fully, but the important pieces yes. Clang and GCC in particular, not sure about MSVC as I don't use it.

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

#49
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.

The downvotes are probably because you said "start with C" while the OP has clearly stated they have experience with C and use it in their day job. P.S. I haven't downvoted you.

Oh I missed that line, thanks. The advice still stands, however - perhaps not to OP. But I think it's even more reason to learn C++20 in OP's case.

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

#50

Unless you're going to be doing something that specifically requires C++ (some game engine related code comes to mind), go with Rust. Most real-world code (by number of codes and lines of code) is something else than C/C++ nowadays, just because of developer velocity and a larger hiring pool. Yes, you can get that last cycle of power from a piece of hardware by going with C or C++, but on the other hand finding peopl…

> "C++" is such a big concept toi grasp fully, that I don't see the point of studying it unless you're getting paid for it.

Not really necessary to grasp the entirety of the language to use it effectively, I dabble in C++ here and there and usually treat it as a fancy C just using stuff like smart pointers, strings and vectors. Even learned some C++17 stuff which made what I was trying to do a lot simpler though I can’t remember what I was up to, think it was some boost lib I was already using that got promoted or std::variant shenanigans with my asdl generator — definitely yaks were being shorn I can say for sure.

Post reply on HN