jlaitine commented on code in PR #16813:
URL: https://github.com/apache/nuttx/pull/16813#discussion_r2259698184


##########
include/nuttx/atomic.h:
##########
@@ -60,8 +60,14 @@ extern "C++"
 #    include <stdatomic.h>
 #    define ATOMIC_FUNC(f, n) atomic_##f##_explicit
 
-  typedef volatile _Atomic int32_t atomic_t;
-  typedef volatile _Atomic int64_t atomic64_t;
+#    if defined(__cplusplus)

Review Comment:
   Exactly because when compiling without the C++ standard includes 
(-nostdinc++), there is no "atomic" include available (this is the c++ standard 
include). "#if  __has_include(\<atomic>\)" will fail already.
   
   But that's fine, the atomic functions from "stdatomic.h" work just fine also 
in C++; the only issues are that there is no __auto_type and parameters in C++ 
may not be "volatile". So it can use the compiler built-in atomic functions, 
just the parameter types need to be C++ compatible.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to