This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Global variables are slower?


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]