|
|
|
|
|
by DixieDev
1485 days ago
|
|
Most likely you specifically don't have much reason to care about Zig. Meanwhile, C can still often be found in areas where high performance and precise control over memory are important - such as in small embedded systems and game engine development - and Zig is a great fit as a replacement. While you can technically use Rust in these domains you'll find yourself jumping through hoops and fighting against quirks that come with it being fairly high-level and very opinionated on how to enforce memory safety. One such scenario I've encountered is implementing my own memcpy with a loop like `for i in 0..len`. This works in release builds, but without optimisations this gets a deeeeep callstack that eventually also calls memcpy, so you get a stack overflow. Note how memcpy is implemented in rlibc to avoid this issue:
https://docs.rs/rlibc/latest/src/rlibc/lib.rs.html#30-38 |
|
It's funny how in rust you can write raw asm, but there seem to be quirks somewhere in the middle.