Skip to main content
greg_t
Associate III
August 17, 2010
Question

volatile const ??

  • August 17, 2010
  • 4 replies
  • 2902 views
Posted on August 17, 2010 at 07:04

volatile const ??

    This topic has been closed for replies.

    4 replies

    domen23
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 14:02

    So that it is actually re-read every time (think hardware registers).

    dthedens2
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 14:02

    There is a good series of articles by Dan Saks about const & volatile.

    Andrew Neil
    Super User
    May 17, 2011
    Posted on May 17, 2011 at 14:02

    ''What is the purpose to make a constant volatile''

    'const' does not actually mean that it's a constant - it just prohibits writes

    ''if it can not be changed anyways ?''

    It cannot be written by the program - but that does not mean that its value will not change!

    As already noted, think of a read-only hardware register...

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:02

    const

    volatile

    ''The semantics here indicate that the register's value is read-only but not necessarily unchanging.''

    http://en.wikipedia.org/wiki/Const-correctness#Volatile-correctness

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..