10 ms·
Are there any studies done that looks at the relative amount of bugs in C code compared to Rust? Making the claim that Rust is better for those applications isn
by MikkoFinell 8y ago
Are there any studies done that looks at the relative amount of bugs in C code compared to Rust? Making the claim that Rust is better for those applications isn't convincing to me until I can see the statistics that backs it up.
- staticassertion 8y agoI think you'll have a hard time finding conclusive research like this for any languages. Many papers exist but often have conflicting results, or weird methodologies, or extreme artificiality. It's really expensive/ hard to generate good research on this topic that controls for the big variables - you basically need a company that's willing to throw away at on of developer time to build two versions of the same product in both languages, then a metric for measuring success, a way to ensure you take dev skill into account, etc. So instead it seems a lot more worthwhile to not bother looking for objective research as it won't be found. I think a better approach is to just use what we have - sense and anecdotes. From a sensibility standpoint, let's take a step back from rust. Do we expect fewer memory safety vulnerabilities in Java vs C? Probably yes - Java is a memory safe language with few escape hatches. So what about Rust vs C? It's a bit less clear as rust has a more oft used escape hatch, but I think we can reason that it's likely to have fewer memory safety bugs. Would we expect fewer bugs in general? That's much harder to discuss with that approach. You can look at testaments from Servo devs, and other companies using Rust ( https://www.rust-lang.org/en-US/whitepapers.html https://www.rust-lang.org/en-US/whitepapers.html ) and their experiences.
- pcwalton 8y agoWe looked at the number of security-critical bugs in one new component of Firefox—Web Audio—a few years ago in order to determine how many of them a memory-safe language would have prevented. The answer was 100%.
- yitchelle 8y agoPardon for ignorance, what language is Firefox written in?
- steveklabnik 8y agoAt the time the analysis was done, the majority was in C++. Now there are some significant Rust components.