Rabu, 22 Februari 2017

How to handle volatile objects and member function in C++

An object which can be modified by some unknown forces (like hardware) other than the program itself can be declared as volatile. Compiler doesn’t apply any optimizations for such volatile objects. Syntax for declaring an volatile object is as follows: volatile ClassName object-name;   A member function can be declared as volatile to make the access to member variables to be volatile. A volatile object can access only volatile functions. Syntax for creating a volatile function is as follows: return-type function-name(params-list) volatile;   Following program demonstrates both volatile objects and volatile programs: 1 2 3 4 5 6 7 8

The post How to handle volatile objects and member function in C++ appeared first on Coding Security.


How to handle volatile objects and member function in C++
read more

Tidak ada komentar:

Posting Komentar