apache / nuttx

Apache NuttX is a mature, real-time embedded operating system (RTOS)
https://nuttx.apache.org/
Apache License 2.0
2.58k stars 1.11k forks source link

CXX C11 Atomic support #11547

Open PetervdPerk-NXP opened 7 months ago

PetervdPerk-NXP commented 7 months ago

If you've got a C C11 library that's using <stdatomic.h> and you want to use this library in CXX you simply can't. C++ provides a compatibility header <atomic> but if you use the NuttX libcxxmini library it doesn't provide a atomic implementation. Unless you use of-course the std libraries but these tend to big.

It would interesting if we could have a minimal <atomic>implementation for libcxxmini.

Do note it seems that C++23 partially fixes this incompatibility. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0943r6.html

Would be interesting if it's possible to backport that.

xiaoxiang781216 commented 7 months ago

Yes, @hujun260 hit the similar issue recently. atomic is a good addition to libcxxmini.