volatile variables in D....

Sean Kelly sean at f4.ca
Thu Apr 12 07:50:44 PDT 2007


Frank Benoit (keinfarbton) wrote:
> is it this you are looking for?
> http://www.digitalmars.com/d/statement.html#VolatileStatement

Technically no, but it should achieve the same thing.  Given the 
functionality of the volatile statement in D:

     int* io = 0x1234;
     int x;

     volatile x = *io;

implicitly guarantees that the load from *io will always occur from 
memory rather than from a cached register value.  I know it's not as 
convenient as labeling a variable as volatile as per C/C++, but it 
should do.


Sean



More information about the Digitalmars-d mailing list