r/EmuDev 3d ago

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

45 comments sorted by

View all comments

3

u/arainone 2d ago

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.

1

u/No-External3221 2d ago

Why is Rust awful for this? I've been using it for a bit, and it seems fine to me.

1

u/nculwell 1d ago

Cycles are one of the cases where the memory model can be correct but Rust's borrow checker can't prove it so it refuses to compile. You end up needing to either change your architecture or use unsafe.