3 ms·
Are there any other devs who think this might be what enables them to contribute to the kernel? I've always felt like there's this enormous mountain of knowledg
by l0b0 5y ago
Are there any other devs who think this might be what enables them to contribute to the kernel? I've always felt like there's this enormous mountain of knowledge I'd have to know to implement the smallest feature in the kernel:
- C pitfalls, probably documented all over the place.
- C idioms. These are hard to locate for most languages; I wouldn't know where to look in case of C.
- Kernel-specific C idioms. This is probably easy to locate and well documented, but I'd still expect it to be several thousand words.
- Code formatting tools. Are there any canonical formatting tools for C, or is it fragmented like for most older languages?
- How to test C code, which IIRC requires jumping through quite a few hoops.
- How to deal with text, which is a nightmare outside of ASCII in most languages.
- tristan957 5y agoNone of that is specific to C except maybe the last one when compared to Rust. 1. Rust has pitfalls 2. Rust has idioms 3. Rust in kernel would have specific idioms 4. clang-format and uncrustify are two solid choices 5. Nothing is special about C that would make testing hard.
- fastasucan 5y agoI think the commenter you replied to meant that they know Rust a lot better than they do C, which makes it easier, particularly since C has such a long history.
- dexterlemmer 5y ago1. Yea, a road that was used for target practice during a large-scale NATO training exercise is the same as a road that could do with a bit of maintenance with painted potholes to warn people. After all, they both have potholes. 2. You are cherry picking. He also said "These are hard to locate for most languages; I wouldn't know where to look in case of C." Rust has some advantages from for example Clippy and from a very newcomer-welcoming and helpful community. 3. Rust in kernel would indeed have kernel-specific idioms. But it'll probably be very similar to other embedded Rust and relatively easy for a newcomer to pick up. (Ee'll have to wait and see, but there is good reason to expect this.) C in kernel is known to be very hard for other C developers to pick up. 4. Thanks for the info. 5. But some things are special about Rust that makes testing easy. 6. The kernel doesn't deal much with text and even when it does, it generally doesn't need to deal with encodings (let alone modern encodings). That said, text is really a nightmare in C. Even just ASCII is needlessly complex due to null-terination, badly designed functions and the regular C UB pitfalls. At least you did acknowledge it may indeed be a problem for C compared to Rust.