3 ms·
Could you give an example of how Zig is more C-like for the seasoned C developer? Rust generally has a lot of what C has, you just might need unsafe to get it.
by nixpulvis 2y ago
Could you give an example of how Zig is more C-like for the seasoned C developer?
Rust generally has a lot of what C has, you just might need unsafe to get it.
One notable omission is `volatile` but that sorta beside the point.
If the concern is just relearning a new STD lib and getting used to error handling with an enum instead of ints, then I suspect you could get up to speed pretty quickly.
Past that, sure the rust crate ecosystem might make use of a lot more complex bits of rust, just like C++ libraries can do wild things with templating.
If you are just comparing C, just avoid the complex stuff and write your Rust function like you write your C functions. It’ll work.
- bschwindHN 2y ago> One notable omission is `volatile` but that sorta beside the point. What do you mean here?
- nixpulvis 2y agoBasically this note: https://doc.rust-lang.org/std/ptr/fn.write_volatile.html#notes https://doc.rust-lang.org/std/ptr/fn.write_volatile.html#not...
- bschwindHN 2y agoI see, thanks!
- wtetzner 2y agoYou can use methods in Rust for volatile reads/writes. https://doc.rust-lang.org/std/ptr/fn.write_volatile.html https://doc.rust-lang.org/std/ptr/fn.write_volatile.html https://doc.rust-lang.org/std/ptr/fn.read_volatile.html https://doc.rust-lang.org/std/ptr/fn.read_volatile.html