C++:volatile
Volatile function
In your code, the volatile keyword does not apply to the function, but to the return type, it is the equivalent of:
Now, in C++ you can make a member function volatile, in the same way that the const qualifier, and the behavior is the same:
Basically you cannot call a non-volatile (alterantively non-const) function on a volatile (const respectively) instance of the type:
struct test {
void vfunction() volatile;
void function();
};
volatile test t;
t.vfunction(); // ok
t.function(); // error
Favorite site
References
-
Skyul.tistory.com_-_C_C++_volatile_keyword.pdf ↩