3 ms·
Rust is easier to learn than C. Specifically, the things that are hard to learn in Rust are things that C will stab you in the back on. The biggest problem wit
by kmeisthax 2y ago
Rust is easier to learn than C. Specifically, the things that are hard to learn in Rust are things that C will stab you in the back on.
The biggest problem with C is having to manually track memory ownership and usage - i.e. who can call free() or dereference pointers without crashing the whole program. Rust automates that away, in a way that introduces no runtime performance overhead.
The problem with "C kernel wizards" is that the things they're good at solving are not part of the essential complexity of writing an operating system kernel. A lot of it is chasing use-after-frees or dangling pointers. Tedious manual work that absolutely can be automated away, but isn't, because forty years of C being The Only Systems Language You'd Dare Fit In A Kernel has made people just assume all its hidden complexity is essential.
- phendrenad2 2y agoCome on, managing memory in C isn't that hard. Yes, there are constant failures because many times people don't have a proper foundation in C memory management before they're allowed near the github commit bit. That's an organizational issue, not a language issue. Rust does eliminate the issue, because it forces people to go through that foundational learning or their code won't actually compile! But C is also fine, if you know what you're doing.
- kmeisthax 2y ago"C is fine if you know what you're doing" is the "trust me, bro" approach to software engineering. Even experienced "C kernel wizards" make stupid mistakes. Also, nobody actually knows what a pointer is, not even the wizards; we keep learning new things about them every time someone finds a combination of optimizations that cause miscompiles[0]. For something as security-critical as an OS kernel, the correct approach is to have automatic verification - i.e. code can't stab you in the back if it can't compile. [0] Pointer provenance was discovered this way
- phendrenad2 2y agoSee, I'm coming from the perspective that people who work with Language X have learned where all the dark corners of Language X are. Would you expect anything else? C does not have more dark corners than Python, Ruby, PHP, LISP, Rust, etc. Part of being an expert is knowing the language you're working with, and knowing the limits of your tools. When you update GCC and they add some bonkers optimization strategy that introduces new undefined behavior, you should know about that. Even experienced "Rust kernel wizards" will make mistakes. You'll see.