On Sun, 6 Feb 2011, Florian Klämpfl wrote:
Am 06.02.2011 18:53, schrieb Bo Berglund:
So in summary:
If the called method changes the length of teh dynamic array it must
be passed as a var, otherwise the length change will be lost when
exiting the method.
I'd even propose that one uses var
On Sat, 05 Feb 2011 15:51:37 +0100, Florian Klaempfl
flor...@freepascal.org wrote:
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
Am 06.02.2011 18:53, schrieb Bo Berglund:
So in summary:
If the called method changes the length of teh dynamic array it must
be passed as a var, otherwise the length change will be lost when
exiting the method.
I'd even propose that one uses var as soon as he plans to change the
array. It
On Fri, 4 Feb 2011 19:10:33 +0100, Jonas Maebe
jonas.ma...@elis.ugent.be wrote:
On 04 Feb 2011, at 16:25, Bo Berglund wrote:
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:
On Sat, 5 Feb 2011, Bo Berglund wrote:
On Fri, 4 Feb 2011 19:10:33 +0100, Jonas Maebe
jonas.ma...@elis.ugent.be wrote:
On 04 Feb 2011, at 16:25, Bo Berglund wrote:
OK, what will happen if I have a declaration like this:
function TSSCommBuf.Read(var Data: TByteArr): boolean;
as opposed to
On Sat, 5 Feb 2011 09:24:44 +0100 (CET),
michael.vancann...@wisa.be wrote:
No. Someone misunderstands the concept of dynamic array here.
A dynamic array is a pointer to an array in memory.
So when passing a dynamic array to a function,
you are, in fact, passing a pointer.
So is there a
On Sat, 5 Feb 2011, Bo Berglund wrote:
On Sat, 5 Feb 2011 09:24:44 +0100 (CET),
michael.vancann...@wisa.be wrote:
No. Someone misunderstands the concept of dynamic array here.
A dynamic array is a pointer to an array in memory.
So when passing a dynamic array to a function,
you are, in
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
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.
--
View this message in context:
On Fri, 4 Feb 2011 06:41:24 -0800 (PST), leledumbo
leledumbo_c...@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
On 04 Feb 2011, at 16:25, Bo Berglund wrote:
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
11 matches
Mail list logo