[fpc-pascal]Re: strange error - compilable code (Luis Del Aguila)
Luis Del Aguila
aguila3000 at terra.com.pe
Fri Apr 18 14:37:56 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
in FPC 1.06 use pointers, example :
type
PTVertex3D = ^TVertex3D; //add this declarations, for use Pointer
TVertex3D = record
x,y,z : single;
end;
var
//Vertices1,Vertices2 : array of TVertex3D; //change declarations
Vertices1,Vertices2 : PTVertex3D;
//procedure TranslateArr(xc,yc,zc:single;var Src,Dst:array of
TVertex3D;count:longint); //change declarations
procedure TranslateArr(xc,yc,zc:single;var
Src,Dst:PTVertex3D;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); //change declarations
Getmem(Vertices1,Sizeof(Vertices1));
Vertices1[0].x := 3;
Vertices1[0].y := 2;
Vertices1[0].z := 1;
//SetLength(Vertices2,1); //change declarations
Getmem(Vertices2,Sizeof(Vertices2));
TranslateArr(5,3,-2,Vertices1,Vertices2,5);
readln
end.
If you need use more vertex, then use this :
Getmem(Vertices1,Sizeof(Vertices1)*5) // for five vertex array
Si tu necesitas usar mas vertices en tu arreglo, entonces debes usar
getmem de esta manera :
Getmem(Vertices1,Sizeof(Vertices1)*5) // para arreglos de 5 vertices
More information about the fpc-pascal
mailing list