Max,
> > Do does delphi handle it's dynamic array passing when passed as
> > a typed parameter,
> > does delphi pass only the reference or does it still pass the
> > entire array as value.
>
> A quick look at the assempbler in System.pas and the code generated by
> dynamic array passing and assignment and reveals that the
> dynamic arrays
> are passed by reference and use reference counting in a very similar
> manner to strings. There is also a very similar sort of local
> stack clean
> up that occurs when you leave a procedure that has created a dynamic
> array.
However, dynamic strings does not employ the copy-on-write semantics of
strings. Therefore, if Delphi passes both of them by reference:
procedure A (s: string) will increment the reference count. Any mods to s
will create a local copy and not modify the original.
procedure B (d: array of Type) will increment the reference count. Any
mods to d will NOT create a local copy and will modify the original!
As you say, a small test program will sort this out.
Regrards,
Dennis.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz