On Friday, 25 October 2013 at 20:10:13 UTC, Walter Bright wrote:
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; }

Frankly, if it is not a big deal, why don't you put those in a std.hardware or std.directaccess module?

If I have to compile those in D outside of main program, why don't allow me to disable the optimizer *for a part* of my D program? Or for a variable?

And if I have to compile those in C, should I go entirely with it and only let the D program to be an "extern int main()"?

OOH you show me it is not a big deal, OTOH you make a big deal from it refusing every support inside the compiler or the standard library.

Should I one day define my own "int plus(int a, int b) { return a+b; }"?

Reply via email to