This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Please support the _Atomic keyword in C++
- From: "Rodrigo V. G." <rodrivg at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 14 May 2018 23:32:27 +0200
- Subject: Please support the _Atomic keyword in C++
In addition to the bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932
I wanted to add some comment:
It would be very useful if the _Atomic keyword would be supported in C++.
This way the <stdatomic.h> header could be included inconditionally in C++ code.
Even if it is not compatible with the C++ <atomic> header, it would be useful.
Supporting the _Atomic keyword in C++ would benefit at least two cases:
- When mixing C and C++ code for interoperability (using, in C++, some
variables declared as _Atomic in a C header).
- When developing operating systems or kernels in C++, in a
freestanding environment (cross compiler), <atomic> is not available,
but <stdatomic.h> is.
So to correctly use things like __atomic_fetch_add in C++ in
freestanding mode, this is the only way. Otherwise one cannot use
atomics at all in these conditions.