3 ms·
I think these types of drivers, taking care of parsing in a place where I would personally say parsing should be avoided where possible, is an excellent place t
by jeroenhd 3y ago
I think these types of drivers, taking care of parsing in a place where I would personally say parsing should be avoided where possible, is an excellent place to move towards Rust. The language may not be great at doing things like low-level memory management, but parsing data and forwarding it to hardware seems like an excellent use case here.
And yes, you can parse safely in C. Unfortunately, correctness in C has been proven to be rather difficult to achieve.
- andrepd 3y agoWhy is rust not good at low-level memory management? Can you give an example?
- matu3ba 3y agoHard mode Rust provides the trickyness of separating memory handling from the (pure) code logic https://matklad.github.io/2022/10/06/hard-mode-rust.html https://matklad.github.io/2022/10/06/hard-mode-rust.html which makes batching inputs unnecessary hard. The other main tradeoff is that explicit lifetime annotations make (big) refactorings or explorative coding harder, unless one uses a lot copies or shared pointers (unacceptable for Kernel code). However, I am not familiar how those two tradeoffs ought to be solved in Kernel. I would expect that Rust would do rarely changing high level abstractions expected to never change fundamentally in design and/or being limited in scope.
- deleted 3y ago[deleted]