downs wrote:
Yesterday, I tried porting parts of libnds (the open-source utility library for
the Nintendo DS) to D.
Worked relatively fine too, templates work, structs work, volatile DOESN'T WORK.
Let me repeat that. Volatile Doesn't Work.
This was my code:
struct VolatilePointerProxy(T) {
T* ptr;
T access(T i) { volatile (*ptr) = i; return i; }
T access() { T res; volatile res = *ptr; return res; }
mixin(PropertyForward!("access"));
}
This prevents the compiler from optimizing memory accesses past access().
It does *NOT* prevent the compiler from removing "redundant" calls to access.
That's not a legal optimization of 'volatile'. I'd file a bug report.
Sean