core.atomics and handling of backward MemoryOrders

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 3 10:51:15 PDT 2015


Hi,

I'm currently re-writing core.atomics for GDC to switch from the 
old GCC __sync_* builtins to the new (more compatible with how 
core.atomics is supposed to function) __atomic_* builtins.

https://github.com/D-Programming-GDC/GDC/pull/111

One thing I've noticed in my reading of this, is that the 
following are accepted as valid, but makes no sense.

---
atomicStore!(MemoryOrder.acq)(var, val);

var = atomicLoad!(MemoryOrder.rel)(val);
---

I'd like to suggest that it should be considered completely valid 
for both cases to throw a compilation error (using static 
assert).  However I'd like the core druntime team to be on board 
with this.

Regards
Iain.


More information about the Digitalmars-d mailing list