[fpc-devel] ref count issue with out param
Martin Frb
lazarus at mfriebe.de
Sat Jun 13 14:27:07 CEST 2015
On 13/06/2015 09:31, Florian Klämpfl wrote:
> It is similar to
>
> type
> tarray = array [1..10] of longint;
>
> procedure p(const a1 : tarray;var a2 : tarray);
> begin
> a2[1]:=4321;
> writeln(a1[1]); // surprise
> end;
>
> var
> arr : tarray;
>
> begin
> arr[1]:=1234;
> p(arr,arr);
> end.
>
I dont see any similarity. You pass 2 pointers to the same memory. No
surprise for me. But also no broken ref counting.
More information about the fpc-devel
mailing list