Please understand
that the volatile modifier is a directive to the compiler’s optimizer that operations involving this
variable should not be optimized in certain ways.
A volatile modifier may be used in two cases:
Case 1: A memory-mapped hardware device may use it.
Case 2: Shared memory may use it.
Also understand that a system has a set of registers that can be accessed faster than its
memory. This is because registers are faster than memory.
A good compiler will perform some
type of optimization called
Do'stlaringiz bilan baham: |