|Global versus Stack variables firstname.lastname@example.org (shrey) (2005-11-19)|
|Re: Global versus Stack variables email@example.com (firstname.lastname@example.org) (2005-11-21)|
|Re: Global versus Stack variables email@example.com (glen herrmannsfeldt) (2005-11-21)|
|Re: Global versus Stack variables firstname.lastname@example.org (2005-11-21)|
|Re: Global versus Stack variables email@example.com (2005-11-21)|
|Re: Global versus Stack variables firstname.lastname@example.org (Jatin Bhateja) (2005-11-26)|
|Re: Global versus Stack variables email@example.com (2005-11-26)|
|[1 later articles]|
|Date:||19 Nov 2005 02:31:21 -0500|
|Keywords:||design, optimize, question|
|Posted-Date:||19 Nov 2005 02:31:21 EST|
I was wondering if ppl can give their opinion on the following
question. What is the impact of a variable being a global or a local
variable on optimizations. In other words, is it likelier to produce
better code if a variable is local than global. The reason I ask this
is I wonder if register allocation is harder if a variable is global
instead of local. Are there other optimizations which get affected due
to this consideration.
[It depends on your language, but in languages with pointers, the
biggest advantage of stack locals is that the compiler can assume
no aliasing of stack variables that haven't had their address taken.
Return to the
Search the comp.compilers archives again.