[fpc-pascal]Re: strange error - compilable code

Luis Del Aguila aguila3000 at terra.com.pe
Thu Apr 17 14:20:13 CEST 2003


The FPC 1.06 don't support dynamic array,
Use FPC 1.1 or use pointer.

El compilador FPC 1.06 no soporta arreglos dinámicos
Es mejor que uses FPC 1.1 o en todo caso usa punteros.

>Can you provided a compilable example that we can use for the test suite.
>Peter

Sure I can.
     Vitek Kavan

{------------------------------------code_start-----------------------------
-----------
This code produces following error:

Free Pascal Compiler version 1.1 [2003/04/08] for i386
Copyright (c) 1993-2002 by Florian Klaempfl
test.pas(34,43) Error: call by var parameters have to match exactly: Got
"Array Of TVertex3D" expected "Array Of TVertex3D"
test.pas(36) Fatal: There were 1 errors compiling module, stopping

Delphi is OK and it works:

Borland Delphi Version 14.0
Copyright (c) 1983,2002 Borland Software Corporation
test.pas(36)
37 lines, 0.03 seconds, 10756 bytes code, 1969 bytes data.
}
type
 TVertex3D = record
  x,y,z : single;
 end;

var
 Vertices1,Vertices2 : array of TVertex3D;

procedure TranslateArr(xc,yc,zc:single;var Src,Dst:array of
TVertex3D;count:longint);
var i : longint;
begin
 for i := 0 to count-1 do
  begin
   Dst[i].x := Src[i].x + xc;
   Dst[i].y := Src[i].y + yc;
   Dst[i].z := Src[i].z + zc;
  end;
end;

begin
 SetLength(Vertices1,1);
 Vertices1[0].x := 3;
 Vertices1[0].y := 2;
 Vertices1[0].z := 1;
 SetLength(Vertices2,1);
 TranslateArr(5,3,-2,Vertices1,Vertices2,1);
end.
{------------------------------------code_end-------------------------------
---------}



--__--__--

_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


End of fpc-pascal Digest





More information about the fpc-pascal mailing list