2 ms·
There is also so much to rust that makes it nearly ideal for the prospect of writing a driver. For example, how many bytes are in an `int`? What is the endian
by cogman10 5y ago
There is also so much to rust that makes it nearly ideal for the prospect of writing a driver.
For example, how many bytes are in an `int`? What is the endianess of your 32bit `int`?
Rust puts up front a lot of the information crucial for cross platform development of hardware drivers.
Rust has few undefined edges which is exactly where C gets into trouble. C, by design, has a bunch of undefined edges.
Honestly, the biggest downside to Rust in the kernel is that Rust is backed by the LLVM, which doesn't have as many supported targets as GCC does. (And, AFAIK, GCC is generally the preferred compiler for the kernel).
- littlestymaar 5y ago> Honestly, the biggest downside to Rust in the kernel is that Rust is backed by the LLVM, which doesn't have as many supported targets as GCC does. (And, AFAIK, GCC is generally the preferred compiler for the kernel). Fortunately, there are now two competing approach to make GCC a viable compiler to Rust[1], and it's moving really fast. I think the LLVM-only situation won't get in the way more than a few more years. [1]: https://lwn.net/SubscriberLink/871283/c437c1364397e70e/ https://lwn.net/SubscriberLink/871283/c437c1364397e70e/
- tialaramex 5y ago> For example, how many bytes are in an `int`? Rust and Linux both have the same name for say the 32-bit unsigned integer type, they both call that u32. This is of course a coincidence, and not an unlikely one, but it probably doesn't hurt for Linux people getting familiar with Rust.