Quantcast
Viewing latest article 5
Browse Latest Browse All 7

Answer by Andrew Henle for Can volatile variables be read multiple times between sequence points?

Per C11, this is undefined behavior.

Per 5.1.2.3 Program execution, paragraph 2 (bolding mine):

Accessing a volatile object, modifying an object, modifying a file, or calling a function that does any of those operations are all side effects ...

And 6.5 Expressions, paragraph 2 (again, bolding mine):

If a side effect on a scalar object is unsequenced relative to either a different side effect on the same scalar object or a value computation using the value of the same scalar object, the behavior is undefined.

Note that, as this is your compiler, you are free to define the behavior should you wish.


Viewing latest article 5
Browse Latest Browse All 7

Trending Articles



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