On 02/24/2011 08:09 AM, Markus Armbruster wrote:
For completeness: a local variable may be necessary to convince the optimizer that the value doesn't change. Cases where this matters exist, but they're rare.
In particular, for non-pointers they're nonexistent if the variable is static and you never use ¤t_migration, i.e. if the variable doesn't escape.
If the above conditions are satisfied and you have a loop that never "leaves" the C file, you could even see the compiler keep the variable in a register for the whole duration of the loop and store the modified change after the loop.
Paolo