[fpc-pascal] Re: Correct use of var in function calls?

Florian Klaempfl florian at freepascal.org
Sat Feb 5 15:51:37 CET 2011


Am 05.02.2011 10:46, schrieb Bo Berglund:
> But that is not what I am doing at all, so I can stick with a simple:
>
> FillArr(Arr: TByteArr)
>
> and be sure that I will not get back a different array, but instead
> get my array filled as requested...
>

As soon as you call SetLength, this will break havoc. Then a deep copy 
is generated and it gets ref. count of 1 and it is destroyed at callee exit.



More information about the fpc-pascal mailing list