volatile keyword in C++

what is volatile keyword in C++ is meant for?
svsathwickAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
From the help files:

Objects declared as volatile are not used in certain optimizations because their values can change at any time. The system always reads the current value of a volatile object at the point it is requested, even if a previous instruction asked for a value from the same object.

In other words - you can be certain the value in that variable is corrrect at the time of reading it (not using any cached value)
0
 
enachemcCommented:
volatile variable: a variable whose value is read from its original address each time it's accessed because the value stored at the original address can be change by concurent threads
0
 
svsathwickAuthor Commented:
lacks example
0
All Courses

From novice to tech pro — start learning today.