Null references redux
Walter Bright
newshound1 at digitalmars.com
Sun Sep 27 01:55:22 PDT 2009
Jeremie Pelletier wrote:
> This may be a good time to ask about how these variables which can be
> declared anywhere in the function scope are implemented.
>
> void bar(bool foo) {
> if(foo) {
> int a = 1;
> ...
> }
> else {
> int a = 2;
> ...
> }
>
> }
>
> is the stack frame using two ints, or is the compiler seeing only one? I
> never bothered to check it out and just declared 'int a = void;' at the
> beginning of the routine to keep the stack frames as small as possible.
They are completely independent variables. One may get assigned to a
register, and not the other.
More information about the Digitalmars-d
mailing list