This is the mail archive of the gcc@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]

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.


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