??? 07/12/07 21:13 Read: times |
#141829 - sequence points and side effects Responding to: ???'s previous message |
The formal definition is in the ISO/IEC 9899 C standard and the accompanying C99 rationale. It is hidden in statements about sequence points of the abstract machine and what is allowed to happen in between them esp. regarding side effects. And reading a volatile variable produces a side effect. But this is really difficult stuff to read and grasp.
I tried to find a good definition or example of this N-time access, but couldn't find it. I even start to wonder now if what I said is true. Maybe the compiler is allowed to read the volatile variable in the switch expression as many times as it sees fit. Maybe it is the programmers responsibility to read it once in a simple assignment expression and to use the copy in the switch expression. But it goes against my gut feeling about what volatile is meant to accomplish. |
Topic | Author | Date |
more to atomicity and such | 01/01/70 00:00 | |
Interesting example ... | 01/01/70 00:00 | |
which I did | 01/01/70 00:00 | |
Aside: Keil - Atomic functions | 01/01/70 00:00 | |
If you can afford it. | 01/01/70 00:00 | |
volatile | 01/01/70 00:00 | |
does this have some formal definition? | 01/01/70 00:00 | |
sequence points and side effects | 01/01/70 00:00 | |
what's exactly the value of volatile, then? | 01/01/70 00:00 | |
example | 01/01/70 00:00 | |
bu what is it good for then? | 01/01/70 00:00 | |
Ok, visualize this one | 01/01/70 00:00 | |
within a loop | 01/01/70 00:00 | |
Memory Mapped I/O | 01/01/70 00:00 | |
OK I see it now, thanks.![]() | 01/01/70 00:00 | |
volatile switch | 01/01/70 00:00 |