| > While it is very difficult to write perfectly safe code in C, this seems to be used as explanation for the amount of CVEs we see. But when I look at the CVEs, the code is often terrible! Given the choice between a language that requires expert coding for minimal safety guarantees and one which can tolerate human error, I’ll take the latter all else equal. Also, given that experts feel they can’t write correct C reliably, I’m inclined not to think I can (never mind contributors). > At the same time, the Rust rewrite of coreutils with more than 100 CVEs does not exactly convince me that the problem is mainly the choice of language. I’m not a Rust fanboy, but I don’t know what I should make of this. Is 100 CVEs a lot for coreutils? If the idea is “Rust doesn’t preclude all CVEs therefore language choice doesn’t matter”, I don’t think that follows. > Still, I think there also many obvious benefits from using C. The only I can think of are that the toolchain—but not the compiled programs—-can run on niche hardware (minor benefit), that bootstrapping may be easier, and that the toolchain may be more performant (although Go compiles faster than most C-based toolchains I’ve seen, so I’m inclined to think the language matters less here than the compiler design itself). |
Again, I do not believe this is true. One gets a reasonable level of safety with only basic measures even in C. In practice, memory safety is also not even remotely the main issue to worry about, especially when writing a compiler.
> Also, given that experts feel they can’t write correct C reliably, I’m inclined not to think I can (never mind contributors).
It is not easy to write correct code in any language. See the number of CVEs in the Rust rewrite of coreutils or generally the number of issues one also sees in Rust projects (including still memory safety issues.) If at all, this means that the C experts are not naive about it.