volatile variables in D....
Sean Kelly
sean at f4.ca
Thu Apr 12 14:57:52 PDT 2007
Derek Parnell wrote:
> 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.
Perhaps in other cases, that's true.
> 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.
Yup. But given that no such feature exists in D right now, I was
suggesting alternatives.
Sean
More information about the Digitalmars-d
mailing list