[fpc-pascal]Re: strange error - compilable code (Luis Del Aguila)

vtech@fpc vtech-fpc at seznam.cz
Tue Apr 22 20:06:24 CEST 2003

Sure I can do it this way, but it's the "old way" :-)
FPC 1.1 obviously tries to compile it my way, but it fails.

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

LDA> El compilador FPC 1.06 no soporta arreglos dinĂ¡micos
LDA> 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.

LDA> in FPC 1.06 use pointers, example :

LDA> type
LDA>  PTVertex3D = ^TVertex3D; //add this declarations, for use Pointer
LDA>  TVertex3D = record
LDA>    x,y,z : single;
LDA>   end;
LDA> var

LDA> //Vertices1,Vertices2 : array of TVertex3D; //change declarations
LDA>  Vertices1,Vertices2 : PTVertex3D;

LDA> //procedure TranslateArr(xc,yc,zc:single;var Src,Dst:array of
LDA> TVertex3D;count:longint); //change declarations

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

LDA> begin
LDA> //SetLength(Vertices1,1); //change declarations
LDA>  Getmem(Vertices1,Sizeof(Vertices1));
LDA>  Vertices1[0].x := 3;
LDA>  Vertices1[0].y := 2;
LDA>  Vertices1[0].z := 1;
LDA> //SetLength(Vertices2,1); //change declarations
LDA>  Getmem(Vertices2,Sizeof(Vertices2));
LDA>  TranslateArr(5,3,-2,Vertices1,Vertices2,5);
LDA>  readln
LDA> end.

LDA> If you need use more vertex, then use this :
LDA> Getmem(Vertices1,Sizeof(Vertices1)*5) // for five vertex array

LDA> Si tu necesitas usar mas vertices en tu arreglo, entonces debes usar
LDA> getmem de esta manera :

LDA> Getmem(Vertices1,Sizeof(Vertices1)*5) // para arreglos de 5 vertices

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

Best regards,
 vtech                            mailto:vtech-fpc at seznam.cz

More information about the fpc-pascal mailing list