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

Bo Berglund bo.berglund at gmail.com
Fri Feb 4 16:25:17 CET 2011


On Fri, 4 Feb 2011 06:41:24 -0800 (PST), leledumbo
<leledumbo_cool at yahoo.co.id> wrote:

>
>FPC is Delphi compatible regarding this. Dynamic arrays are passed by
>reference, so you don't need var here. Please be aware when you directly
>play with dynamic array contents, since it's actually a pointer to a record
>in heap and it's reference counted.

OK, what will happen if I have a declaration like this:
function TSSCommBuf.Read(var Data: TByteArr): boolean; 
as opposed to
function TSSCommBuf.Read(Data: TByteArr): boolean;

Will they be equivalent or will there be an "extra layer" of pointer??


Bo Berglund




More information about the fpc-pascal mailing list