3 ms·
I think with modern hardware you could significantly reduce the amount of C code but I'm not sure you could eliminate it entirely. Rust is trying to do just tha
by kbolino 2y ago
I think with modern hardware you could significantly reduce the amount of C code but I'm not sure you could eliminate it entirely. Rust is trying to do just that but IMO isn't really comparable to the languages you mentioned. Maybe if microkernels had taken off and/or hardware drivers were written with more abstract interfaces, things might have been different even on the much cheaper hardware that won out.
- pjmlp 2y agoThere are plenty of OS written in C++, already that is an improvement over bare bones C. For example, Meadow uses a C++ mikrokernel, with everything else written in C#. https://www.wildernesslabs.co/ https://www.wildernesslabs.co/
- kbolino 2y agoI'd be surprised if they can use all of C++'s advantages in a freestanding environment. Even Rust struggles there though at least it's a first-class option.
- yencabulator 2y ago> significantly reduce the amount of C code but I'm not sure you could eliminate it entirely Theseus is a research OS written in Rust that seems to include C purely to show how to support programs written in C (libc and a demo app). https://github.com/theseus-os/Theseus https://github.com/theseus-os/Theseus It contains some 1000+ lines of ASM for the early boot from BIOS, that look like they originate from https://os.phil-opp.com/minimal-rust-kernel/ https://os.phil-opp.com/minimal-rust-kernel/ -- I think UEFI boot would have been doable in pure Rust (https://github.com/rust-osdev/uefi-rs https://github.com/rust-osdev/uefi-rs).
- kbolino 2y agoRust certainly provides much stronger guarantees than C, though some of its features aren't available (or at least don't come batteries included) in a freestanding (no_std) environment. The borrow checker is also a lot less forgiving than a garbage collector.