On Fri, May 4, 2012 at 1:09 PM, John Harrison <harr...@tigermail.auburn.edu> wrote: > Which is not that different, just more explicit, but again I do not know how > the optimizer would interact with that kind of a statement. It would be nice > to be able to mark an expression as volatile possibly instead of a variable.
It should work fine. In LLVM volatile operations are marked at the load/store level, so it would map to the same IR as volatile accesses in C would. (LLVM's semantics for volatile operations is documented at http://llvm.org/docs/LangRef.html#volatile , if you're curious.) Even in C, I've seen a lot of code that makes volatile load/stores explicit at the site of the operation with operations of the form 'int x; *(volatile int*)&x = 1;' in favor of using volatile typed variables. If you want the type safety of a volatile type in Rust, you could define a volatile<T> enum that only allowed access using methods defined in terms of the volatile primitives. -Joe _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev