Volatile (computer programming): Difference between revisions

Content deleted Content added
Marudubshinki (talk | contribs)
No edit summary
Marudubshinki (talk | contribs)
No edit summary
Line 1:
In [[computer programming]], a [[variable]] or object declared with the '''volatile''' [[Keyword_(Computer)|keyword]] may be modified externally from the declaring object. For example, a variable that might be concurrently modified by multiple [[Thread_(computer_science)|threads]] (without [[Lock_(computer_science)|locks]] or a similar form of [[mutual exclusion]]) should be declared volatile. Variables declared to be volatile will not be optimized by the [[compiler]] because their value can change at any time.
 
===What can happen if volatile is not used?===
The following piece of [[C_programming_language|C]] [[source code]] demonstrates the use of the volatile keyword.