Volatile (keyword): Difference between revisions

m
no edit summary
[unchecked revision][unchecked revision]
mNo edit summary
Line 1:
== Definition ==
 
The volatile statementkeyword gives an indication to the compiler/optimizer that it should always perform a read or write to a variable or memory without caching it locally. It also ensures that the order of changes is preserved and not altered by the optimizer, and that apparently redundant code is not optimized away.
 
== The basics ==
Line 82:
}
 
Also see anthe [[APIC#IO_APIC_Configuration|APIC example code]] where the volatile keyword is crucial (reading/writing to hardware registers): [[APIC#IO_APIC_Configuration|APIC]].
Anonymous user