I updated my system to gdc master. As expected, my program that
uses shared variables to accress hardware registers did not work
any more. I took the old Volatile datatype we made some years ago
and the modified version is something like this:
struct Volatile(T) {
T raw;
nothrow:
@disable this(this);
A opAssign(A)(A a) { volatileStore(&raw, a); return a; }
T load() @property { return volatileLoad(&raw); }
alias load this;
void opOpAssign(string OP)(const T rhs) {
auto v = volatileLoad(&raw);
mixin("v " ~ OP ~ "= rhs;");
volatileStore(&raw, v);
}
}
I did some simple tests and this seems to work.
My question is: is this the way we should go?
If it is, what would be the preferred name for this type? Also
what would you think should be the module and file name?