volatile variables in D....

Davidl Davidl at 126.com
Thu Apr 12 06:56:17 PDT 2007


worth consideration!!
And the volatile statement we have now is completely not usable compare to
C++'s volatile prefix vars

> 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