Einzelnen Beitrag anzeigen

Der schöne Günther

Registriert seit: 6. Mär 2013
6.110 Beiträge
 
Delphi 10 Seattle Enterprise
 
#3

AW: Kann man statische Arrays so gleichsetzen?

  Alt 9. Okt 2014, 09:59
Genau so ein Testprojekt hatte ich auch grade einbringen wollen, aber der rote Kasten war schneller. Dann halt nur noch das Zitat auzs dem DocWiki:

Zitat aus dem DocWiki:

Zitat:
Unlike strings and static arrays, copy-on-write is not employed for dynamic arrays, so they are not automatically copied before they are written to. For example, after this code executes:
Delphi-Quellcode:
 var
   A, B: array of Integer;
   begin
     SetLength(A, 1);
     A[0] := 1;
     B := A;
     B[0] := 2;
   end;
the value of A[0] is 2. (If A and B were static arrays, A[0] would still be 1.)
  Mit Zitat antworten Zitat