This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add atomic type qualifier


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]