Quantcast
Channel: Can I perform arithmetic operations on an atomic variable directly? - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by zwol for Can I perform arithmetic operations on an atomic variable...

Compound assignments to variables with atomic types are explicitly allowed in C2011: quoting N1570 §6.15.6.2p3A compound assignment of the form E1 op= E2 is equivalent to the simple assignment...

View Article


Answer by Adrian Mole for Can I perform arithmetic operations on an atomic...

The i += 10; statement maintains the atomicity of i, because it is used as an lvalue expression. From cppreference (bolding mine):Built-in increment and decrement operators and compoundassignment are...

View Article


Can I perform arithmetic operations on an atomic variable directly?

Can I perform arithmetic operations on an atomic variable directly?Since I find the C standard library provides a lot of utility functions like atomic_fetch_add to perform the addition between an...

View Article
Browsing latest articles
Browse All 3 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>