5 ms·
I imagine that in C if the compiler can prove that two pointers don't alias than it can elide a load?
by staticassertion 6y ago
I imagine that in C if the compiler can prove that two pointers don't alias than it can elide a load?
- pjmlp 6y agoIt is very much compiler specific, and also depends if modifiers like volatile are present or not.
- Jweb_Guru 6y agoSure, or with C++ TBAA it can do that too, but those rules work differently from the kinds of guarantees that Rust's type system provides. The C equivalent is (sort of) restrict, but it's used very rarely--so no one has really worked out what its semantics would be like if it were used at the same scale it is in Rust, and there are a lot of bugs.