1,105,242 Community Members

Identifier Redeclared error

Member Avatar
Morten Brendefu
Light Poster
44 posts since Mar 2011
Reputation Points: 28 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]
 
0
 

Dear enlightened ones.
First of all. I am using Delphi 9.
My code compiles and run with no error at all, still I am confused about the structure window in the Delphi window.
It tells me that I have redeclared some identifiers.
The thing is that I have a few overloaded procedures of which uses different parameters only. The code in each procedure is however very similar, hence I use same local variables.

I think the structure window is wrong in its assumption, but I am not 100% certain.
All of these procedures are marked with overload-directive in unit declaration.

My logic say that maybe it is enough to declare the local variables in first procedure since they are Overloaded.
I tried commenting out the local var and variable where the Structure window tell me they are redeclared, and it seem to work alright.
what I don't seem to grasp is that I do not get the redeclared error in all the overloaded procedures only a few of them.

I would really appreciate some thoughts on this issue.
I think that even though the procedures are Overloaded, the correct approach is to have the declaration of local variables in place in every one of them.
Compiling does not cause problems and unit works flawlessly.
:-/ Is this a known issue with the Structure window?

PROCEDURE DynamicCreateIndex(VAR ArrParam:DynamicLongIntArray; VAR ArrParamIndex: DynamicIntegerArray);
  VAR
    x : INTEGER;
  BEGIN
    FOR x:=0 TO HIGH(ArrParamIndex) DO BinarySortIndex(ArrParam,ArrParamIndex,x);
  END;
PROCEDURE DynamicCreateIndex(VAR ArrParam,ArrParamIndex: DynamicIntegerArray);
  VAR
    x : INTEGER; // Error in Structure Inspector. Tells me the identifier is redeclared.
  BEGIN
    FOR x:=0 TO HIGH(ArrParamIndex) DO BinarySortIndex(ArrParam,ArrParamIndex,x);
  END;
PROCEDURE DynamicCreateIndex(VAR ArrParam:DynamicStringArray;  VAR ArrParamIndex: DynamicIntegerArray);
  VAR
    x : INTEGER;
  BEGIN
    FOR x:=0 TO HIGH(ArrParamIndex) DO BinarySortIndex(ArrParam,ArrParamIndex,x);
  END;
PROCEDURE DynamicCreateIndex(VAR ArrParam:DynamicLongIntArray; VAR ArrParamIndex: DynamicIntegerArray; CONST HighBound:INTEGER);
  VAR
    x : INTEGER;
  BEGIN
    FOR x:=0 TO HighBound DO BinarySortIndex(ArrParam,ArrParamIndex,x);
  END;
PROCEDURE DynamicCreateIndex(VAR ArrParam,ArrParamIndex: DynamicIntegerArray; CONST HighBound:INTEGER);
  VAR
    x : INTEGER; // Error in Structure Inspector. Tells me the identifier is redeclared.
  BEGIN
    FOR x:=0 TO HighBound DO BinarySortIndex(ArrParam,ArrParamIndex,x);
  END;
PROCEDURE DynamicCreateIndex(VAR ArrParam:DynamicStringArray; VAR ArrParamIndex: DynamicIntegerArray; CONST HighBound:INTEGER);
  VAR
    x : INTEGER;
  BEGIN
    FOR x:=0 TO HighBound DO BinarySortIndex(ArrParam,ArrParamIndex,x);
  END;
Member Avatar
pritaeas
mod_pritaeas
11,291 posts since Jul 2006
Reputation Points: 1,420 [?]
Q&As Helped to Solve: 1,832 [?]
Skill Endorsements: 155 [?]
Moderator
Featured
Sponsor
 
0
 

Structure window does not always recognize everything, even in Delphi XE. I have had similar problems, where the code works fine, but the structure window shows all kinds of errors.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: