4 ms·
&mut pointers ensure that they are the _only_ reachable alias to a given bit of memory.
by steveklabnik 12y ago
&mut pointers ensure that they are the _only_ reachable alias to a given bit of memory.
- duaneb 12y agoSo, it's functionally equivalent to a "restrict" keyword in unsafe mode? (i.e. you can alias without the compiler being able to prove it as if you weren't aliasing.)
- steveklabnik 12y agoMy C is a bit Rusty, so I'll say that they follow http://llvm.org/docs/LangRef.html#noalias http://llvm.org/docs/LangRef.html#noalias which says > Note that this definition of noalias is intentionally similar to the > definition of restrict in C99 for function arguments. I'm not sure if they just mean 'similar' or if it's actually exact. If you alias, you might break, as optimizations will assume otherwise. Oh, and `&mut` pointers are safe to use, not unsafe.