[PATCH] Add atomic type qualifier
Andrew MacLeod
amacleod@redhat.com
Fri Jul 26 19:34:00 GMT 2013
On 07/26/2013 03:01 PM, Andi Kleen wrote:
> Andrew MacLeod <amacleod@redhat.com> writes:
>> What it doesn't do:
>> * It doesn't implement the C11 expression expansion into atomic
>> built-ins. ie, you can't write:
>> _Atomic int x;
>> x = 0;
>> and have the result be an atomic operation calling
>> __atomic_store (&x, 0).
> How would this work if you want a different memory order?
>
>
The way the standard is defined, any implicit operation like that is
seq_cst. If you want something other than seq-cst, you have to
explicitly call atomic_store (&x, 0, model).
C11 also provides all those same atomic routines that c++11 provides for
this reason. They just decided to try to implement the c++ atomic
templates in the language along the way :-P so it feels very much like
c++ atomics...
Andrew
More information about the Gcc-patches
mailing list