Live data from Hacker News

Should I learn C++ or Rust?

news.ycombinator.com

1–10 of 13 posts

Should I learn C++ or Rust?

#1
OK, A little context, i know C, Python and JS. I like C so much and i code to learn and for fun(one day to make FOSS apps too UwU). So i want to learn two things, QT and Games, my first thought was, learn C++, the game engine is Godot. both Godot and QT have a good support for C++, Rust on these are not 100% yet, but rust is getting popular and i want to continue up-to-date. so what do you guys think about?

Re: Should I learn C++ or Rust?

#7
You can learn both, but for sure start with C++ first; this way, you will understand why they created Rust back in the day, even though C++ has evolved and still does.

Eventually you will appreciate both languages' pros and cons, depending how you use them in each case separately.

Re: Should I learn C++ or Rust?

#9

I'd vote C++. Rust is terrible for complex problems requiring experimentation (ie don't know what you don't know) and tight feed back loops. For gaming it's probably the wrong choice.

What concrete advantages does OP gain from solving a problem in Rust? If you're considering creating a language binding in Rust, you can't easily bypass C, the predominant language for operating systems, and may end up using “unsafe” anyway. While you can designate certain parts as safe and others as unsafe, the real question is: what tangible benefit does this bring to you? Is safety truly a crucial factor? Various tools like Clang-Tidy and cppcheck, as well as the SEI CERT C Coding Standard, address safety concerns.

On the flip side, Rust has great error messages and boasts a robust package manager, “cargo” (more convenient than say CMake) but lacks libraries such as STB, Catch2, nlohmann::json, and DirectX Math, OpenGL, …

Although there are bindings to libraries for DirectX Math created by others, the question remains: are they genuinely production-ready? C and C++ have a long history, they are different languages, but they are arguably orthogonal. Not completely different.

I would say: do not focus on languages, more on solving problems. That means, learn fundamental subjects well (geometry, linear algebra, calculus, differential equations). If people like Karpathy and Jensen are right, then being very good at a particular programming language might not have much of an importance.

https://karpathy.medium.com/software-2-0-a64152b37c35

Re: Should I learn C++ or Rust?

#10
The argument for learning Rust before C++ is that the compiler will teach you the best practices you'd have to discover the hard way when programming in C++.

If you have to work in C++, you can take that intuition with you.

But if game dev is your motivation, it makes sense to just jump to C++.

Post reply on HN