Vote UpVote

A String of Byte?

The Programming Works – Dynamic arrays are implemented in Delphi as lifetime-managed reference types without “copy-on-write” support. What does it mean on practice can be shown by the following code: program Project1; {$APPTYPE CONSOLE} type TIntArray = array of Integer; var A, B: TIntArray; begin A:= TIntArray.Create(1,2,3) B:= A; // B = (1,2,3) A[0]:= 10; // A = (10,2,3), B = (10,2,3) Writeln(B[0]); readln; end. A and B are just the same references, so by changing a value referenced by A we also change the same value referenced by B. That makes dynamic arrays different from ...
Favorite? Off-Topic? Serg @ 2010-07-30 10:43


Visits: 764
Votes: 0
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)