[fpc-pascal] parameter names local, global, glocal

Wolfram Kläger wolfram.klaeger at web.de
Wed Jan 18 21:21:23 CET 2006


Hi, it´s me, the guy with this internal error recently, while porting 
OpenXML to FP. Meanwhile, the compiler switch -B did help me out. 
Apparently by compiling all units, regardless wether they have been changed 
or not, this internal error is avoided. Now I believe this B stands for 
Back to hell, since there are other surprises with duplicate identifiers, 
where I never thought it could happen, see the following example.

unit xdom31;
uses
   ... xmltreeutils, ...
type
TDomNode = class (TDomCustomNode)
   private ...
   protected ...
   public ...
   property NamespaceURI: WideString read GetNamespaceURI; ...

TDomCharacterData = class (TDomNode)
   private ...
   protected ...
   public ...
     function SubstringData(const Offset, Count: Integer): WideString; virtual;

     // FPC: identifier COUNT already defined in unit xmltreeutils at line 98

     procedure ReplaceData(const Offset, Count: Integer) ...

     // FPC: identifier COUNT already defined in unit xmltreeutils at line 98
...

TDomAttr = class (TDomNode)
   private  ...
   protected  ...
   public ...
     constructor CreateNS(
	const AOwner: TDomDocumentNS;
           const NamespaceURI ...

     // FPC: identifier NamespaceURI already defined at line 1192
...

unit xmltreeutils;
...
type
TCustomOwnedNode = class(TCustomOwnedObject)
   private ...
   protected ...
   property Count: Integer read GetCount;
   ...

Conclusion: never call any parameter of any procedure or function exactly 
like any property of any class and its ancestors. So far I thought, 
parameter names of functions and procedures are always local, i.e. valid 
for this function or procedure block only. Is this a bug or feature of FPC 
vs. Delphi?

Disclaimer: I love all FPC warnings and hints. Each may be an unknown error 
less. In or in front of the machine.

Wolfram
-- 
Mosaikfabrik (r)  Bilder von Bildern  www.mosaikfabrik.de
MEMPHIS GmbH  HRB Kirchheim/Teck 1231  Geschäftsführer
Wolfram Kläger  Wrangellstrasse 11  D-70599 Stuttgart
Tel. (+49) 0711 31 944 39  Fax (+49) 012126 31 944 944




More information about the fpc-pascal mailing list