3 ms·
A C based rtos inherits all the difficulties present in C. Ideally Rust is interesting, to me, as an ideal language to write the RTOS itself in. Once you get th
by elcritch 11y ago
A C based rtos inherits all the difficulties present in C. Ideally Rust is interesting, to me, as an ideal language to write the RTOS itself in. Once you get through the low level details, writing a (simple) schedule system is not hard and would be more flexible due to the better types safety in Rust. Also C is difficult for DSLs, Rust should be better. That's the dream at least.
- petra 11y ago>> A C based rtos inherits all the difficulties present in C. Can you please expand on that, especially assuming(a big assumption) that the c code you're interfacing is high quality , with rare bugs ?
- antoinealb 11y agoEven assuming the existing code is high quality, there is still a lot of problems with pointer ownership and type checking which Rust removes. Personally I think the best way is to wrap existing C code into higher level, safer Rust APIs.
- elcritch 11y agoExactly, even the most disciplined code base will have errors. Rust type system "automates" the process that many well designed C code bases will do by convention (e.g. borrowing and keeping ownership localised). While wrapping C libraries in safer Rust APIs is useful for many application, having something as fundamental as time-sharing, task interruption, etc would be much better if written in Rust and care is taken to define simple semantics for the system (e.g. like the recent HN post regarding state-machine based asynchronous IO in Rust).