3 ms·
Writing an emulator is not really embedded programming (the target often qualifies as an embedded environment but the host can be any random desktop computer).
by simias 8y ago
Writing an emulator is not really embedded programming (the target often qualifies as an embedded environment but the host can be any random desktop computer).
It's definitely possible to write an emulator without unsafe code. Here's a toy gameboy emulator I wrote a while ago in Rust without any unsafe code: https://github.com/simias/gb-rs https://github.com/simias/gb-rs
Here's a very incomplete PSX emulator with only a single unsafe (which might not even be necessary anymore, I haven't updated the code in a while): https://github.com/simias/rustation https://github.com/simias/rustation
- mzs 8y agoAre you sure about that? https://github.com/simias/gb-rs/blob/master/Cargo.toml#L29 https://github.com/simias/gb-rs/blob/master/Cargo.toml#L29
- simias 8y agoThe SDL2 dependency? I don't understand what you mean by that. Or are you saying that a dependency that I use happens to use unsafe code? In which case it's true but then by that definition it's effectively almost impossible to write 100% safe rust since the stdlib itself contains a non-negligible amount of unsafe code.
- steveklabnik 8y agoIt’s always impossible, as you have to call into the OS at some point to do anything of use.