Re:The relative performance of C and Rust
by vnorilo on Saturday September 29, 2018 @01:31AM
(#18098856)
Right. In C, correctness is by convention, not enforced. C++ allows "userland" enforcement via RAII. There are, however, pieces of compiler magic partially outside the type system (const, &, &&) - you can't specify such behavior within C++. Rust does more of this magic in ownership. If you just want a particular instruction soup, all of them will get you there. It's a question of ergonomics, convenience and the kinds of compiler guarantees that we want.
If c were built with good generics and memory management (not that garbage preprocessor stuff), I expect similarly expressive and good data-structures would be built.
C++ is an affirmation of this because it happens to have good libraries of data-structures which are not really very different from rust's.
I don't think this is as much "rust's design forces the coder to do this" and more "c makes it hard to do as nice of a design"