Fixing core.atomic
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Mon May 31 20:43:37 UTC 2021
On Monday, 31 May 2021 at 20:01:57 UTC, Max Haughton wrote:
> On Monday, 31 May 2021 at 17:51:26 UTC, IGotD- wrote:
>> On Monday, 31 May 2021 at 16:34:35 UTC, Guillaume Piolat wrote:
>>>
>>> I prefer atomicLoad and atomicStore then, because it's
>>> explicit and it's useless to hide the fact it's atomic behind
>>> nice syntax.
>>
>> Yes, you can use it if you want to. We will not remove the
>> regular D atomic functions.
>
> That and the C++ `std::atomic` will provide the same semantics
> on types of wide size (LDC and GDC seem to differ in behaviour
> here when you use the atomic primitive functions.)
Are you sure?
«All atomic types except for std::atomic_flag may be implemented
using mutexes or other locking operations, rather than using the
lock-free atomic CPU instructions.»
https://en.cppreference.com/w/cpp/atomic/atomic_is_lock_free
C/C++ is trying to be hardware-independent to a much larger
extent than D.
More information about the Digitalmars-d
mailing list