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;

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.