Atomic floats on x86_64

Andrew Haley aph@redhat.com
Mon Nov 10 18:09:00 GMT 2014


On 11/10/2014 05:49 PM, Jonathan Wakely wrote:
> On 10 November 2014 16:46, Andrew Haley wrote:
>> What do you believe a __builtin does but a standard atomic does not do?
> 
> Both C11 and C++11 only support atomic operations on their "atomic
> types" and there's no atomic float type (although I'm not sure the
> builtins should really support floating point types either).
> 
> The atomic types are also incompatible between C11, as in C they use
> the _Atomic qualifier and in C++ they are struct types. So although
> you can write this in both languages, it doesn't have the same
> meaning:
> 
> atomic_int i;
> atomic_store(&i, 1);
> 
> (Because WG14 made a last-minute change to the design that very
> deliberately allowed compatibility between the languages.)

Hmm.  That is reasonable enough, but given that GCC nonstandardly
allows atomic_store() et al to work on float, why prefer a GCC
nonstandard builtin?

Andrew.



More information about the Gcc-help mailing list