Re:Google says replacing C/C++ in firmware with Rust is easy
by wtetzner on Saturday September 07, 2024 @11:15PM
(#41477955)
You can use methods in Rust for volatile reads/writes.
Re:Google says replacing C/C++ in firmware with Rust is easy
by bschwindHN on Saturday September 07, 2024 @10:53PM
(#41477874)
> One notable omission is `volatile` but that sorta beside the point.
What do you mean here?
Re:Google says replacing C/C++ in firmware with Rust is easy
by nixpulvis on Sunday September 08, 2024 @12:10AM
(#41478152)
Basically this note: https://doc.rust-lang.org/std/ptr/fn.write_volatile.html#not...
Re:Google says replacing C/C++ in firmware with Rust is easy
by bschwindHN on Wednesday September 11, 2024 @11:08AM
(#41512083)
I see, thanks!
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.