scoping question

Ian Lance Taylor iant@google.com
Tue Aug 11 20:19:00 GMT 2009


Todd <todd.freed@gmail.com> writes:

> My question is, is it possible, from within the inner scope, to refer
> to the variables and labels defined in the outer scope (whose names
> have been overridden)

If the name of the variable has been overridden, then you can not refer
to the object directly.  This is the same case as

    int i;
    {
      int i;
      i = 1; /* Refers to inner 'i', not outer one.  The outer 'i' is
                hidden.  */
    }

Of course you could use a pointer, pass a parameter to the inner
function, etc.

Ian



More information about the Gcc-help mailing list