Re: volatile

Discussion in 'C++' started by David Sachs, Oct 27, 2003.

  1. David Sachs

    David Sachs Guest

    "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.
    David Sachs, Oct 27, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Knute Johnson

    Re: Volatile?

    Knute Johnson, Jul 1, 2003, in forum: Java
    Replies:
    17
    Views:
    1,446
    Knute Johnson
    Jul 3, 2003
  2. Doug Pardee

    Re: Volatile?

    Doug Pardee, Jul 1, 2003, in forum: Java
    Replies:
    0
    Views:
    897
    Doug Pardee
    Jul 1, 2003
  3. Replies:
    1
    Views:
    914
    Knute Johnson
    Aug 29, 2003
  4. Daniel

    Can volatile be trusted?

    Daniel, Sep 11, 2003, in forum: Java
    Replies:
    7
    Views:
    473
    Chris Uppal
    Sep 12, 2003
  5. ben
    Replies:
    5
    Views:
    593
    Ulrich Eckhardt
    Jan 11, 2005
Loading...

Share This Page