The trouble with volatile
The trouble with volatile
Posted May 14, 2007 15:07 UTC (Mon) by BenHutchings (subscriber, #37955)In reply to: The trouble with volatile by mikov
Parent article: The trouble with volatile
"People might argue that it is useful with signals or longjmp(), but the need for volatile in such scenarios is always an indication of a serious problem in the code."
These are the two cases defined by the standard where volatile *must* be used for certain variables. Memory-mapped I/O is the third case it was intended for, but as that's inherently unportable the standard doesn't explicitly mention it. (I think the rationale does.)
