/volatile (volatile Keyword Interpretation)
The latest version of this topic can be found at -volatile (volatile Keyword Interpretation).
Specifies how the volatile keyword is to be interpreted.
volatile semantics as defined by the ISO-standard C++ language. Acquire/release semantics are not guaranteed on volatile accesses. If the compiler targets ARM, this is the default interpretation of
Selects Microsoft extended
volatile semantics, which add memory ordering guarantees beyond the ISO-standard C++ language. Acquire/release semantics are guaranteed on volatile accesses. However, this option also forces the compiler to generate hardware memory barriers, which might add significant overhead on ARM and other weak memory-ordering architectures. If the compiler targets any platform except ARM, this is default interpretation of
We strongly recommend that you use /volatile:iso along with explicit synchronization primitives and compiler intrinsics when you are dealing with memory that is shared across threads. For more information, see volatile.
If you port existing code or change this option in the middle of a project, it may be helpful to enable warning C4746 to identify code locations that are affected by the difference in semantics.
There is no
#pragma equivalent to control this option.
To set the /volatile compiler option in Visual Studio
Open the Property Pages dialog box for the project. For more information, see How to: Open Project Property Pages.
Select the C/C++ folder.
Select the Command Line property page.
In the Additional options box, add