Quantcast
Channel: Can volatile variables be read multiple times between sequence points? - Stack Overflow
Browsing latest articles
Browse All 7 View Live

Answer by supercat for Can volatile variables be read multiple times between...

The Standard has no terminology more specific than "Undefined Behavior" to describe actions which should be unambiguously defined on some implementations, or even the vast majority of them, but may...

View Article


Answer by Toby Speight for Can volatile variables be read multiple times...

No diagnostic is required for programs with Undefined Behaviour, except where specifically mentioned. So it's not wrong to accept this code.In general, it's not possible to know whether the same...

View Article


Answer by Steve Summit for Can volatile variables be read multiple times...

As other answers have pointed out, accessing a volatile-qualified variable is a side effect, and side effects are interesting, and having multiple side effects between sequence points is especially...

View Article

Answer by Lundin for Can volatile variables be read multiple times between...

Reading the (ISO 9899:2018) standard literally, then it is undefined behavior.C17 5.1.2.3/2 - definition of side effects:Accessing a volatile object, modifying an object, modifying a file, or calling a...

View Article

Answer by Andrew Henle for Can volatile variables be read multiple times...

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...

View Article


Answer by 0___________ for Can volatile variables be read multiple times...

IMO it is legal but very bad. int new_thing = thingy - (thingy + thingy);Multiple use of volatile variables in one expression is allowed and no warning is needed. But from the programmer's point of...

View Article

Can volatile variables be read multiple times between sequence points?

I'm making my own C compiler to try to learn as much details as possible about C. I'm now trying to understand exactly how volatile objects work.What is confusing is that, every read access in the code...

View Article
Browsing latest articles
Browse All 7 View Live


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