On Saturday, 25 January 2014 at 10:00:58 UTC, Johannes Pfau wrote:
(For example it isn't valid in D to access a shared variable with normal operations anyway, AFAIK. You need to use the atomicOp things and these will the worry about the hardware part, using the correct
instructions and so on)

Is it invalid to access shared data on stack too? How about closures?

See also:
http://www.drdobbs.com/parallel/volatile-vs-volatile/212701484

So volatile is a completely different thing in C#/JAVA and C/C++. This is why I'm confused, C compilers are not supposed to guarantee that another thread can see all changes to a volatile variable, volatile must
just prevent compiler optimizations. So if Itanium C compilers
automatically use the barrier/fence instructions for volatile that's
IMHO a compiler performance bug.

The standard says "memory" and doesn't address cache and processor optimizations, so it probably allows different interpretations. Even if there's no fence, disallowed compiler optimizations are still a performance hit - on all platforms.

Reply via email to