volatile variables in D....

Forest Ray disto at flying-guillotine.com
Wed Apr 11 23:13:20 PDT 2007


What is the correct way to impliment a volatile variable ala C++ in D?  For example an ISR which triggers
every 1 ms does some work and increments a heartbeat variable.  How does one define this?  In C++ you
would define it as "volatile unsigned int timer_1ms;" and all referance would aways read from/write to the
memory location.  In D do you have to use the volatile key word on every statement that access this
variable?  That would be rather klunky and error prone, not to mention gdc does not always do the correct
thing.  Now that D is getting proper 'const', maybe it should get proper 'volatile'.

Mark



More information about the Digitalmars-d mailing list