Posted Aug 7, 2012 14:37 UTC (Tue) by PaulMcKenney (subscriber, #9624)
[Link]
And one of the corresponding bugs for your suggested approach of marking the variable volatile and caching the value in a temporary is failure to update the temporary when updating the underlying variable. So I remain unconvinced.
Declaring it volatile
Posted Aug 7, 2012 19:44 UTC (Tue) by daglwn (subscriber, #65432)
[Link]
If the programmmer is optimizing by using a temporary, the assumption is that the programmer knows what he or she is doing. The optimization is explicit and is an immediate flag to the reader to carefully examine the (existing or new) code for bugs.
I'm not trying to convince you, simply stating what I believe is good programming practice. Maybe I'm wrong. But it's worked for me so far. :)
Declaring it volatile
Posted Aug 8, 2012 15:26 UTC (Wed) by PaulMcKenney (subscriber, #9624)
[Link]