Since Visual C++ 2005, Microsoft has made additional ordering guarantees for accesses to volatile
types which are not required by the C++ Standard.
Does anything in the C++ Standard actually forbid these guarantees? The Microsoft documentation seems to think so.
Please let me know whether the Standard allows the ordering implemented by Microsoft, and also vote on this bug report:
/volatile:ms
documentation mangles what "ISO compliant" meansAn operation has acquire semantics if other processors will always see its effect before any subsequent operation's effect. An operation has release semantics if other processors will see every preceding operation's effect before the effect of the operation itself.
Volatile is a qualifier that is applied to a variable when it is declared. It tells the compiler that the value of the variable may change at any time-without any action being taken by the code the compiler finds nearby.
In C and C++Operations on volatile variables are not atomic, nor do they establish a proper happens-before relationship for threading.
An implementation is certainly allowed to do things beyond on what is required as long as it meets the requirements set forth by the standard. Adding release/acquire semantics to volatile
object is definitely within scope. I don't think there is interest in the C++ committee to change the semantics (we are just starting a new week of discussing C++ in Portland with Herb right now talking about how to organize the meeting).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With