I'm told this belongs here and not in glibc-help...
----------
The C11/C18 Standard defines, for <stdatomic.h>, for example:
C atomic_fetch_<key>(volatile A *object, M operand);
where "An A refers to one of the atomic types."
So:
_Atomic(uint64_t) foo ;
uint64_t bar ;
bar = atomic_fetch_add(&foo, 1) ;
is all by the book.
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 ?
On my x86_64, gcc 9.2/glibc 2.30 do not think it is an error, and indeed
for the x86_64 _Atomic(uint64_t) and uint64_t are identical.
But this looks like a trap for the unwary... on some machine out there,
the Standard says 'bar = atomic_fetch_add(&bar, 1) ;' is a *mistake*.
Or will gcc/glibs throw an error on such a machine ?