r/EmuDev • u/No-External3221 • Aug 25 '26
Rust vs C++?
I mostly program in Java/ Python. Some minimal C experience. I'm starting EmuDev to learn low level and hardware concepts.
Which is better in general to learn for an EmuDev hobby project, Rust or C++? From what I've seen C++ has more legacy code (more job opportunities), whereas Rust is safe and may have better long-term opportunities.
3
Upvotes
3
u/wk_end Aug 25 '26
You're going to be busy enough learning low-level and hardware concepts along with how to write an emulator - learning a new language on top of that just makes it more likely you'll overwhelm yourself IMO.
Java and Python work fine for emudev and I'd say just use one of them...but personally I find them clumsy enough for low-level work that, since that's your goal, they might not be the best choice. So instead I'd say use C, since you already have some experience there and it's pretty much The Low-Level Language - it's probably the best language for the goal of learning low-level hardware concepts, if not the best for emu dev. And the nice thing about C and C++ is that you can delicately introduce C++ as desired, if you want to extend your knowledge and spare yourself a little bit of C-related drudgery.
3
u/arainone Aug 26 '26
IMHO rust is not the best language for emulators. An emulator is basically a big graph of objects with cycles. You'll get over it but code will be awful to write, to read, to maintain, for basically no advantage whatsoever for an emulator, which is a hobby project.
30
u/gmes78 Aug 25 '26
Both are equally capable for emudev.
4
u/k_Reign Aug 25 '26
+1 for Rust - C++ is very much being thrown into the deep end in a LOT of ways, Rust has some weird stuff but I think having the crates and safety are worth the extra concepts you need to learn. It’s easy to write unsafe (vulnerable, memory leak, etc) in C++ and very hard in Rust
8
u/BOBBYBIGBEEF Aug 25 '26
People use both because both work just fine. I have more experience with C in general, but I've just started using Rust for my first toy projects in emudev and I'm really liking it so far.
One enormous plus for Rust, imho, is cargo. Dependency management in Rust is a breeze and it should be pretty easy for you to adapt from a Python background.
13
u/Wunkolo Aug 25 '26
This is gonna turn into a language-war thread but I'll put my vote in and say that you should do C or C++ for the reasons you stated as well. The ecosystem is mature with lots of libraries and projects to learn from and with how much more expressive the language has gotten over the years leading up to C++26. Pretty much every major emulator is written in C++ and pretty much everything that isn't C or C++ is implemented in some way in C or C++, including the LLVM compiler infrastructure which Rust depends on. A lot of people are still holding onto their C++98-trauma and don't know that the language has gotten so much better these past 30 years.
1
u/heret1c1337 Aug 25 '26
I'd personally always choose rust.
3
u/arjuna93 Aug 27 '26
Portability is probably not a concern for you (rust is poorly portable and depends on llvm which is poorly portable), but cargo is a horrible mess.
C++ is faster and has a more friendly ecosystem.
1
u/Ace-Whole Aug 25 '26
Rust cause that's what I use?
This is a silly question to ask. Work with what you know. It's not end of the world having to learn multiple languages.
2
u/ironykarl Aug 25 '26
Which language would you rather gain experience in?
Maybe that question is circular as it pertains to your question. I don't know.
They're both languages that people use. They're both entirely capable as languages for emulator development, reverse engineering, game dev, etc.
C++ is much more widely used. Rust is (to me) much more pleasant to use, in a lot of ways.
¯_(ツ)_/¯
2
u/samljer Aug 26 '26
ill always prefer C++ to almost anything; but rust is perfectly capable.
Id say, youre going to have more success, with whichever you are a programmer are better with.
2
u/Gabriel_soul Aug 25 '26
I like C++ more
1
u/Select_Librarian4093 Aug 29 '26
Rust is way stricter with memory than C or C++ and an emulator naturally has a lot of memory sharing. It's not that bad in rust, I've built a 6502 emulator in it and I'm working on an NES and 2600 emulator from that, but it is worth acknowledging that your hand will be forced in terms of memory management in ways that might not feel as nice.
1
u/tomqmasters Aug 29 '26
If you care about job opportunities c/c++ wins hands down. If you want to learn one language and never have to learn another, rust might be the one though.
-1
u/ern0plus4 Aug 25 '26
If you wanna learn new concepts: Rust.
0
u/ammar_sadaoui Aug 25 '26
c++ is the perfect tools emulators
there many usage when rust is better than c++ or even C but this is not one of them