Thread: volatile modifier

  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    33

    volatile modifier

    What is use of "volatile" modifier .....
    and can I declare like "const volatile"



    Thank you..

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    396
    From the standard - 6.7.3 6 "An object that has volatile-qualified type may be modified in ways unknown to the implementation or have other unknown side effects. [...] What constitutes an access to an object that has volatile-qualified type is implementation-defined."

    This mostly indicates the compiler to avoid any optimisation on that variable.
    Using const with it is fine.

  3. #3
    Registered User
    Join Date
    Aug 2012
    Posts
    33
    please give any small sample program with volatile and without volatile

  4. #4

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. const modifier at end of signature
    By help_seed in forum C++ Programming
    Replies: 7
    Last Post: 12-06-2009, 03:42 AM
  2. const modifier
    By Vertex34 in forum C Programming
    Replies: 8
    Last Post: 09-27-2004, 07:22 PM
  3. DNS & Mail settings modifier
    By DemonSoul in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 05-20-2004, 12:43 PM
  4. Clipboard Modifier
    By Korhedron in forum Windows Programming
    Replies: 2
    Last Post: 01-03-2004, 02:32 PM

Tags for this Thread