[fpc-pascal] Re: More fun with dynamic arrays

andrew.bennett at ns.sympatico.ca andrew.bennett at ns.sympatico.ca
Sat Nov 19 15:34:24 CET 2011


On Fri, 18 Nov 2011 23:11:14 -0800 (PST)  leledumbo <leledumbo_cool at yahoo.co.id>  wrote

re use of "Out" parameters
>  ...  As stated in the 
> docs (http://www.freepascal.org/docs-html/ref/refsu57.html): "The initial 
> value of the parameter on function entry is discarded, and should not be 
> used." which is why you get 0. 

It seems a bit drastic to me to discard the existence of the dynamic array
as well as the (non-existent) values stored in it! Presumably, all will be well 
if I size the array inside the initializing routine, breaking my rule that the 
routine that makes the array must also contain the code to get rid of it.
>  
> > 2) I substitute "Array Of Longint" for "DataA". 
>  
> That would make X parameter to be treated as "open array of longint" not 
> "dynamic array of longint" 

That is a distinction too subtle for me!

Andrew Bennett





More information about the fpc-pascal mailing list