[fpc-pascal] Dynamic Array, operator +

Mathias m_burkhard at gmx.ch
Sun May 20 18:39:20 CEST 2018


Mixing dynamic and static array does not work properly yet.

I compiled the following code with the latest trunk of FPC (revision 39062):


procedure Ausgabe(a: array of byte);
var
   i: integer;
begin
   for i := 0 to Length(a) - 1 do begin
     Write(a[i]: 4);
   end;
   WriteLn();
end;

procedure TForm1.Button1Click(Sender: TObject);
var
   a, b, c: array of byte;
   d: array[0..2] of byte = (6, 7, 8);
begin
   a := [1, 2, 3];
   Ausgabe(a);           // io.

   b := a + d + [123, 222];
   Ausgabe(b);           // error  --> Output:  1   2   3 123 222 123 222

   b := a + [123, 222];
   c := b + b;
   Ausgabe(c);           // io.
   Delete(c, 2, 2);
   Ausgabe(c);           // io.

   c := Concat(a, d, a); // io.
   Ausgabe(c);

   c := a + d + a;       // io.
   Ausgabe(c);


   //  d := [5, 6, 7]; // geht nicht
end;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180520/f3f05e0b/attachment.html>


More information about the fpc-pascal mailing list