Редактиране

Споделяне чрез


Compiler Warning C4746

volatile access of '<expression>' is subject to /volatile:[iso|ms] setting; consider using __iso_volatile_load/store intrinsic functions.

C4746 is emitted whenever a volatile variable is accessed directly. It's intended to help developers identify code locations that are affected by the specific volatile model currently specified (which can be controlled with the /volatile compiler option). In particular, it can be useful in locating compiler-generated hardware memory barriers when /volatile:ms is used.

The __iso_volatile_load/store intrinsics can be used to explicitly access volatile memory without being affected by the volatile model. Using these intrinsics will not trigger C4746.

This warning is off by default. See Compiler Warnings That Are Off by Default for more information.