volatile variables in D....
Derek Parnell
derek at psych.ward
Thu Apr 12 14:55:34 PDT 2007
On Thu, 12 Apr 2007 08:18:48 -0700, Sean Kelly wrote:
> Oh, if you're so inclined, tango.core.Atomic in Tango should achieve the
> same result ...
I'm sure now that the people trying to help the OP just are not
understanding the problem.
The problem is that in D, one must code the 'volatile' keyword on *EVERY*
access of the variable if one wants to force the compiler to do real memory
fetch and store operations, otherwise the compiler /might/ cache a fetch or
store value when it optimizes the machine code. The OP was asking for a
shorthand way to do this ... namely apply the 'volatile' keyword to a
variable so that the compiler will behave as if the coder had used
'volatile' on each and every access to that variable.
--
Derek Parnell
Melbourne, Australia
"Justice for David Hicks!"
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list