Paul Ishenin wrote:
Marco van de Voort wrote:
Do you have unit tests for multidimensional arrays. I saw quite funky
examples (involving dummy variables) in the D2009 help for that.
No. I know delphi allows to enumerate multidimensional arrays but fpc traverses only the first dimension.
To be more precise:

{$apptype console}
type
 TSingleDimArray = array[0..1] of integer;
 TMultyDimArray = array[0..1] of TSingleDimArray;
var
 MultyDimArray: TMultyDimArray;
 a: TSingleDimArray;
 i: integer;
begin
 MultyDimArray[0,0]:=1;
 MultyDimArray[0,1]:=2;
 MultyDimArray[1,0]:=3;
 MultyDimArray[1,1]:=4;
 for a in MultyDimArray do
   for i in a do
     WriteLn(i);

 for i in MultyDimArray do
   Writeln(i);
end.

The example compiles and works fine in Delphi. In fpc the second for-in loop gives an error. I will try to solve this later.

Best regards,
Paul Ishenin.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to