[fpc-pascal] Variable scope concurrency

Marc Santhoff M.Santhoff at t-online.de
Thu Oct 14 05:20:12 CEST 2004


Hi,

I wonder what happens, if there are two variables with exactly the same
name in scope, when one is in the interface part of one unit as a global
and the other is in the implementation part of the crrent unit.

When the variable name is adressed inside a procedure:

unit one;
uses two;
...
implementation
var
	mydoublevar: integer;

procedure anything;
begin
	mydoubledvar := 0;
end;

end.

unit two;
interface
var
	mydoubledvar: integer;
...
end.

Which one wins?

Is there a syntactic definition in the pascal language for this case and
how does fpc handle it?

My feeling tells me the "nearer" one should, in unit one in the
example...

TIA,
Marc





More information about the fpc-pascal mailing list