The trouble with volatile
Posted May 10, 2007 22:04 UTC (Thu) by ncm
Parent article: The trouble with volatile
People who think they want something volatile should know that assigning to a volatile variable, or through a pointer to volatile, generates a store instruction followed by a load instruction. The load is normally optimized away, but the language definition says it's there (because an assignment has a value), and you said you didn't want optimization. Sometimes the extra load just slows things down, but if the address is really a register, it may be actively wrong.
to post comments)