"newsock" <> wrote in message
news:hSnmb.192282$...
> Why need to qualify a member function "volatile"?
>
> Why need to qualify a object "volatile"?
>
> When need to "const_cast" away "volatile" of an object and a member
> function?
>
> I also saw some code of a function argument of "volatile" type. What's
the
> purpose there?
The "volatile" qualifier for an item, indicates that the item is subject to
possible modification by some means outside the current program, and must
therefore be actually accessed every time it is referred to.
Common uses of volatile are for:
Items subject to modification by hardware, such as memory mapped IO
addresses.
Item subject to asynchronous modification by the operating system. This
may include items used as software interlocks.
It is perfectly legal, and often logical, for an item to be both const and
volatile. Such an item is subject to modification but not by the current
program.
If a class object may is volatile, only its volatile member functions may be
used.
|