ARM bare-metal programming in D (cont) - volatile

Walter Bright newshound2 at digitalmars.com
Fri Oct 25 13:10:14 PDT 2013


On 10/24/2013 4:13 AM, eles wrote:
> 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.

Why wouldn't they work with arithmetic expressions?

     poke(0x888777, peek(0x12345678) + 1);


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

     T peek(T)(T* addr) { return *addr; }

     void poke(T)(T* addr, T value) { *addr = value; }


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

D's most excellent support for inline assembler should do nicely.



More information about the Digitalmars-d mailing list