4 ms·
> C and Rust have different aliasing rules, with Rust's being much more restrictive. Rust is more restrictive by default, but C's restrict keyword lets you opt
by jsheard 2y ago
> C and Rust have different aliasing rules, with Rust's being much more restrictive.
Rust is more restrictive by default, but C's restrict keyword lets you opt-in to strict aliasing semantics in exchange for unlocking compiler optimizations that would otherwise be unsound, so it's not like you're free from having to think about aliasing in high performance C code.
- kelnos 2y agoAgreed, but in practice defaults do matter, and it's pretty rare that I see a C code base that actually makes use of 'restrict' etc. It's nice to see it sprinkled liberally throughout glibc's headers, but that's the exception, not the rule.
- physicsguy 2y agoIt’s in pretty much every simulation code base I’ve worked on (both academic + industry)