Should atomic_xxx() functions reject not-_Atomic() arguments ?

Chris Hall
Fri Feb 28 21:04:00 GMT 2020

On 28/02/2020 01:01, Jim Wilson wrote:
> On Thu, Feb 27, 2020 at 7:20 AM Chris Hall <> wrote:
>> Now, the Standard also tells us that _Atomic(uint64_t) and uint64_t may
>> have different sizes, representations and alignment.  So I guess:
>>      bar = atomic_fetch_add(&bar, 1) ;
>> should be an error ?

> __atomic_fetch_add accepts any integer or pointer type.  So the fact
> that _Atomic(uint64_t) and uint64_t may be different types is not a
> problem, as long as they are still integer types.  This works like an
> overloaded function in C++.

Sure.  But the Standard atomic_fetch_add() takes an _Atomic(xxx)* (as 
the first parameter), and for the reasons given, I understand that 
uint64_t* is not compatible with _Atomic(uint64_t)*.


More information about the Gcc-help mailing list