assume, assert, enforce, @safe
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 31 15:08:01 PDT 2014
On 7/31/2014 9:02 AM, Artur Skawina via Digitalmars-d wrote:
>>> The solution is to tell the compiler that you really need that newly
>>> (over-)written data. Eg
>>>
>>> asm {"" : : "m" (*cast(typeof(password[0])[9999999]*)password.ptr); }
>>
>> inline asm is not portable
>
> That's why a portable compiler barrier interface is needed.
> But this was just an example showing a zero-cost solution. A portable
> fallback is always possible (the bug report was about C code -- there,
> a loop that reads the data and stores a copy into a volatile location
> would work).
This is not a "barrier" operation. There you are thinking of atomic operations.
This is a case of a "volatile" operation, and this supports it for D:
https://github.com/D-Programming-Language/druntime/pull/892
Of course, someone has to actually pull it!
More information about the Digitalmars-d
mailing list