Quantcast
Channel: Can atomic loads be merged in the C++ memory model? - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by Damon for Can atomic loads be merged in the C++ memory model?

Yes, in your particular example (no otherwise).Your particular example has a single thread of execution, foo has static storage duration and initialization (that is, before main is entered) and it is...

View Article



Answer by Filip Roséen - refp for Can atomic loads be merged in the C++...

Yes, because we can not observe the difference!An implementation is allowed to turn your snippet into the following (pseudo-implementation).int __loaded_foo = foo;int x = __loaded_foo;int y =...

View Article

Can atomic loads be merged in the C++ memory model?

Consider the C++ 11 snippet below. For GCC and clang this compiles to two (sequentially consistent) loads of foo. (Editor's note: compilers do not optimize atomics, see this Q&A for more details,...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images

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