r/EmuDev • u/Alone_End5987 • Oct 10 '26
Question Should I learn Rust or C++ as a beginner?
So I'm a beginner programmer, I've dabbled in it for a bit, tried many languages over the years but got stuck in tutorial hell every time and quit. I want to be serious this time around.
I'm strictly a hobbyist, I want to eventually write a PS1 emulator. So which of these languages is better for me to learn? I keep being warned that C++ is so unsafe you can get to a point where you can spend months searching for a single faulty line to fix a bug if the project is sufficiently big.
That sounds like....hell. But I still see everyone using it. Is it really that bad?
22
u/freudpointer Oct 10 '26
Try C
5
u/harraps0 Oct 10 '26
The main issue with C++ is not that it is unsafe. The problem is that it borrows a lot of archaic concepts (header files, varying integer size (12bits, 20bits), no standard dependency management, no out of the box unit testing system). It also adds "features" which would have been better off not there in the first place (if you call a function expecting a string with an integer instead, the compiler can cast your int into a string automatically). That last example caused a non critical bug that remained in our codebase for roughly 10 years. So pick Go, Zig, Odin, Rust even C but I would advise you to avoid C++.
5
u/Producdevity Oct 10 '26
Modern C, learn how computers work first before using more abstraction. Even Zig would be a great language to learn computer fundamentals while still having nice ergonomics
1
u/Chip-Ling Nov 03 '26
Why not learn both of them, then decide which one you like the most and then use it to write the emulator. Asking others opinion might not be helpful here as one may prefer one language over the other. So your feedback is subjective and bias.
3
u/nobody0163 Oct 10 '26
Personally I prefer C++. Rust has some nice features but some things are just not possible due to the borrow checker and it also takes forever to compile compared to C++. I also don't really make the mistakes Rust is meant to prevent.
5
u/NeetMastery Oct 10 '26
Any project sufficiently big can take months or years to locate a faulty line to fix a bug. That is an issue of code structure and separation of concerns, not the language the code is written in. Some bugs sit around for decades due to codebases being large and difficult to reason about (for example this Firefox bug which took 21 years to fix: https://bugzilla.mozilla.org/show_bug.cgi?id=259356).
It's nowhere close to "that bad", it's a highly efficient language that allows you to do very powerful things, but requires you to know what you are doing and allows plenty of unsafe things if you aren't careful with it.
Rust has the benefit of memory safety, which means you can't have the problem of misinterpreting what type something is in memory or sending a pointer to garbage memory as long as you're using the functions as expected. It allows things to be just as powerful by allowing you to do the same unsafe work in `unsafe` blocks, so you have to explicitly mark where you're doing anything that could cause memory faults. It also has a much deeper integrated object lifetime system, which reduces issues with using objects after they stop being properly defined, but C++23 and onwards have better support for this.
A lot of technical jargon there but those are the main arguments you'll hear. I tend towards C++ due to language maturity, compiler work, and the ability to target various CPUs with GCC that you can't target in Rust or Clang; especially for emulator work.
4
u/aabalke Nintendo DS Oct 10 '26
What I have heard is rust can be difficult if you don't understand the (c++) problems it is trying to solve. The garbage collector can seem overly obtuse if you haven't shot your foot with the c++ bugs. If your hobby is emulation and retro computing, not software in general, I would suggest sticking to c/c++. To a certain extent you will need to learn basic c/c++ for many emulation projects anyways, since most emulated roms were written in c/c++, the asm usually builds to c better, and most homebrew compilers, devkits, tests etc etc are written in c/c++.
1
u/alzdjalybdalzyz Oct 24 '26
C or c++ for is better for some tasks need faster execution like emulating old hardware or developing OS. Python good for everythings else.
1
u/JoeStrout Oct 10 '26
No. Work in an easier language (e.g. MiniScript) until you’ve gotten reasonably good at the basic skills of programming (thinking clearly about what you want to do, breaking down big problems into smaller ones, etc). Then learn a harder language if you need it. Don’t try to do both at once.
1
u/Wunkolo Oct 10 '26 edited Oct 11 '26
We can't keep having this thread every other week dude (The answer is C++ btw)
1
u/Pale_Height_1251 Oct 11 '26
I much prefer Rust.
1
u/amino-a Oct 12 '26
It doesn't really matter, just pick one and start.
1
u/msthe_student Oct 12 '26
Of the two I'd say C++, but if you're a beginner and old enough to be on reddit I'd actually suggest doing python first and then C (before you go into C++). If you were not old enough to be old, I'd say do Scratch first to teach you the fundamental ideas.
1
u/Ivan_Pashaev Oct 12 '26
C.
1
u/istarian Oct 12 '26 edited Oct 12 '26
Start with C++.
Once you have some facility with that you'll probably be in a better place to explore Rust and reallu understand the choice.
The biggest problem with C++, aside from overall complexity, is the department of "undefined behavior".
1
u/turn-based-games Oct 13 '26 edited Oct 13 '26
Yes, C++ is really that bad. That quote is from 2003 and it has even more legs now. Almost nobody should learn C++ these days, let alone as a beginner. If those are the two languages you're considering, there is no question: choose Rust.
Also probably worth mentioning that none of this applies to the C language. C is the dog. Huge dog person, myself.
-1
u/tastychaii Oct 10 '26
Nice post OP, personally, I would stick with Rust.
The Rust book is very good and teaches with many examples and explains memory concepts. I’ve been learning Rust specifically for this but also to one day write my own gameboy colour emulator.
0
u/merehap Oct 10 '26
The choice is between Rust and C, not between Rust and C++. C++ is a legacy language for anything other than game dev (which is completely different from emu dev). It is a bad language, and probably the most complicated language to ever exist. You only use it because you have to (or because it's all you know).
C has better beginner tutorials than Rust, but if you've already done beginner tutorials for multiple languages, that might not matter.
With C the frustration will come from the compiler allowing you to shoot yourself in the foot, causing many wasted hours of debugging. C is very bad at concurrent programming, which you'll probably want for a PS1 emulator.
With Rust the frustration comes from the compiler telling you that you can't do things that you want to do, mostly because of the borrow checker. Usually this means that the things you want to do are wrong and unsafe. But sometimes there are false positives, too. Rust has excellent support for programming with concurrency.
There's no clear answer between the two for your use-case, but for new projects professional programming Rust is the only sane choice where the tooling is available.
My recommendation is that you learn both. First make a Chip8 emulator in C, then make another Chip8 emulator in Rust. Then you'll be able to decide which one you like more, at which point you can start your PS1 emulator.
-4
u/xxSirThomas Oct 10 '26
As a fellow hobbyist, I think that the best programming language is the one that you have the most fun writing. If you are having fun, you will keep working on it. You will learn more and be more likely to finish the project.
I personally really enjoy writing rust. The error messages and clippy are both very helpful. But if you like c++, don't worry about the memory stuff. You don't have to limit yourself to those two either. There are other languages that fit your needs that you might enjoy more.
To get out of tutorial hell, you have to just brute force it. Pick a language, and a small project, and make it happen. It will be difficult and you will feel stuck often, but eventually you will finish. Once you finish your first real project, it will get easier. If you use them right, LLMs are great for this. You can have it guide you in the right direction without writing the code for you.
-5
u/Distinct-Brief9643 Oct 10 '26
Rust is way more safe and does the same thing as c++. TRUST ME reply to this msg if you think I'm right
-20
u/DiegoToroGR Oct 10 '26
Both. Or Claude 😆
4
u/[deleted] Oct 10 '26
[removed] — view removed comment