[fpc-pascal] Dynamic arrays, yet another pitfall
Sven Barth
pascaldragon at googlemail.com
Sun Feb 9 20:13:40 CET 2014
On 09.02.2014 19:10, patspiper wrote:
> On 09/02/14 18:47, Sven Barth wrote:
>> On 09.02.2014 16:34, Flávio Etrusco wrote:
>>>
>>> In other words: dynamic arrays are like AnsiStrings without the
>>> copy-on-write semantics. I'd certainly wish Borland copied the COW
>>> semantics :-/
>>
>> Dynamic arrays have full COW semantics.
>
> It seems not:
> SetLength(A,10);
> A[0]:=33;
> B:=A;
> A[0]:=31;
> b[0]:=9;
> WriteLn(a[0], b[0]); // prints 9 and 9 (fpc 2.6.3)
Ehm yes... seems that I was mistaken a bit by the dynamic array
implementation. *blush*
Regards,
Sven
More information about the fpc-pascal
mailing list