3 ms·
On the langage on itself rust lack many expressives features (but "slowly" catch up) that modern c++ has. As for memory safety, I'm not aware of safety features
by The_rationalist 8y ago
On the langage on itself rust lack many expressives features (but "slowly" catch up) that modern c++ has.
As for memory safety, I'm not aware of safety features on the Langage on itself but the rust tooling is like third world in comparison.
First of all rust has a very incomplete sanitizers support.
Ubsan, Msan etc
https://github.com/rust-lang/rust/issues/39699 https://github.com/rust-lang/rust/issues/39699
Secondly there is an order of magnitude more static analysis tools that support cpp than rust (but Facebook (a leader in static analysis) is developing a promising one for rust.
As for Fuzzers I'm not aware if they're Langage agnostic.
Finally there are less (if none?) program provers for rust code.
- wwright 8y agoSanitizers and fuzzers are a valid complaint, but static analysis is much less of a problem for Rust vs C++. Most of the issues C++ analyzers detect are prevented by Rust’s design itself, and Rust has an official analyzer in Clippy. Provers are also a fair complaint, though it’s going to be comparatively super rare that that is an issue in practice :p
- the_why_of_y 8y agoThere may be more static analysis tools available for C++, but the quality of the static analysis built right into Rust's type system blows all of them out of the water; no tool for C++ that I've used (Coverity, Infer, PVS-Studio, ...) can reliably prevent use-after-free or data races. Due to the type system, safe Rust code has much less need for sanitizers (leaks and lock order checks are useful) or fuzzers (they'll only find infinite loops); granted, you do have a point in that sanitizers are very useful for unsafe Rust code. There's AFL for Rust: https://github.com/rust-fuzz/afl.rs https://github.com/rust-fuzz/afl.rs [Edit:] With regard to theorem provers, my understanding is that you typically work in some sort of functional language and the correct C/C++ code is generated as a final step at the end (program extraction); certainly Coq and the HOL family work that way. There's already Rust program extraction for Coq, although I wouldn't be surprised if it's not as mature as C yet: https://github.com/pirapira/coq2rust https://github.com/pirapira/coq2rust In other areas, Rust already has an advantage; compare Cargo with the Babylonian chaos of C++ build sytems, where the question isn't even which one you want to use, but how many different ones are imposed on you by external constraints and how to integrate them without going crazy.