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

leledumbo leledumbo_cool at yahoo.co.id
Sat Nov 19 08:11:14 CET 2011


The correct results are obtained if 
> 1) I substitute "Var" for "Out". This leads to the warning that X is not 
initialized. 

"var" could be used to treat the parameter as in-out, so the warning is
expected if you haven't initialized the variable before. 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.

> 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"


--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/More-fun-with-dynamic-arrays-tp5002872p5006382.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.



More information about the fpc-pascal mailing list