3 ms·
I do not think this works, because volatile has no effect, if you do not access prevent_optimization. I'm also not sure of erydo's approach. Given "volatile in
by qznc 14y ago
I do not think this works, because volatile has no effect, if you do not access prevent_optimization.
I'm also not sure of erydo's approach. Given "volatile int x", is "(x+1)" a volatile access? I cannot clarify that with ANSI C99.
- deleted 14y ago[deleted]
- nkurz 14y agoI think (hope?) that the write would be counted as an "access". If not, this would break the "what if this was an IO port" analogue. If for some reason it wasn't, you could use a static variable to hold the result. I fear the real problem with "volatile" is that just about everything about it is implementation dependent rather than clearly defined by standard.