Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-04

Re: strange error - compilable code

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author
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----------------------------------------}
Luis Del Aguila

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-------------------------------
---------}

--__--__--

Vit Kavan
to Luis Del Aguila

Uso FPC 1.1 ya, lee la mensaje del error. No quiero que usar punteros aqui.

Oh gosh, my spanish sucks :-) Just look at the error from my original message: "...Compiler version 1.1...". I'd really like to solve it using dynamic arrays, as the Delphi code works well and I want to keep it working (ie. minimize unnecessary changes).

Show quoted text 76 lines
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 - http://lists.freepascal.org/mailman/listinfo/fpc-pascal End of fpc-pascal Digest _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

______________________________________________________________________ Reklama:
PUPENDO - poselstvi budoucim generacim. V kinech od 27. brezna. http://www.falcon.cz/film.asp?film=498