On Thursday, 24 October 2013 at 05:37:49 UTC, Walter Bright wrote:
On 10/23/2013 5:43 PM, Mike wrote:
volatile was never a reliable method for dealing with memory mapped I/O. The correct and guaranteed way to make this work is to write two "peek" and "poke" functions to read/write a particular memory address:

    int peek(int* p);
    void poke(int* p, int value);

Implement them in the obvious way, and compile them separately so the optimizer will not try to inline/optimize them.

I rised the problem here:

http://forum.dlang.org/thread/[email protected]

Anyway, poke's and peek's are a bit more cumbersome than volatile variables, since they do not cope so well, for example, with arithmetic expressions.

Anyway, still better than nothing. *If* they would exist.

IMHO, the embedded and hardware interfacing should get more attention.

Reply via email to