On Saturday, 25 April 2015 at 19:33:05 UTC, Johannes Pfau wrote:
Am Sat, 25 Apr 2015 18:31:45 +0000
schrieb "Jens Bauer" <doc...@who.no>:

I don't want to start another volatile discussion, but to me it seems an attribute would not be a bad idea. -And for completeness... read-only, write-only, read/write and perhaps even 'prohibited access'. I recall that something was marked prohibited in some way in a library once; I forgot how they did it, though.

volatileLoad is not in gdc yet. I've written the code some months ago
but I need to update it and then it needs to be reviewed.

I might be able to do a few tests, but I don't feel qualified for code reviewing at this time. ;)

Always using volatileLoad/Store is annoying. The solution is to write a wrapper:

I was hoping for something in that direction.

Volatile!size_t value;

{snip}

Usage:
    auto b = PORTB.load();
    PORTB.toggle!"PIN0";
    PORTB.PIN0 = Level.low;
    writeln(PORTB.PIN0);
    PORTB.TEST = 0b000;

It is much more convenient to use it this way, yes; I think it will cover most needs. Regarding performance: If a real high time-critical speed is needed, people would probably use assembly code anyway. ;)

Reply via email to