Global variables are slower?

Anjul Srivastava anjul.srivastava@sanchez.com
Fri Feb 11 14:16:00 GMT 2000


Hello 
folks,
 
Somebody told me 
that accessing a global variable requires an extra instruction, and thus, global 
variables are slower than local variables.
 
Is this true for gcc 
generated code? I'm surprised if it is because I understood from my knowledge of 
C that there was no performance difference between local and global 
variables.
 
Can it be optimized 
out, at least for repeated accesses, if it is true?
 
Thanks a 
lot,
Anjul.



More information about the Gcc mailing list