Hacker News new | ask | show | jobs
Should I learn C++ or Rust?
10 points by Repose0941 844 days ago
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?
8 comments

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

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.

learn Rust so you can tell others you know Rust, learn C++ to actually get a job and do real work :)
Rust is still lacking good GUI libraries and C++ and there are lots of libraries out there written in C++. Rust is more up and coming. That said in my opinion Rust is a nicer and better language since you get cargo and a modern safe efficient language. In my opinion Cargo is great and CMake and similar tools for C++ are not nearly as nice.
I find Clojure, Racket and F# to be nice, yet, it being nice does not help to pay your bills (most likely judging by the job openings you see at those job search sites). But it might help you to enjoy programming again. There are Clojure shops out there, but look at, Indeed, how many Clojure positions vs. how many regular language positions are out there?
Plain and simple C99, even though C99 syntax is already too rich.

I would recommend risc-v assembly, and to run it on x86_64/arm/etc with an interpreter.

....amazing It remembers me the why i don't want to work in tech, people do thislol
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++.

Rust is enterprised focused. Not really applicable for things like game design.

You already pretty much know C++, its just C with a few extensions mostly around classes. Good C++ codebases avoid most of the stuff in C++ language anyways.

Learn both, but use Rust long term.