[fpc-pascal] High() and Low() for empty dynamic arrays

Fred van Stappen fiens at hotmail.com
Sun Feb 9 13:05:35 CET 2014


Hello everybody.

I have a question (maybe stupid) about dynamic arrays...

Usually, before to close the application, to avoid memory leak, i do :

  if length(MyArray) > 0 then
 for x := 0 to high(MyArray) do
 MyArray[x].Free;

But, if i use : 

 setlength(MyArray, 0) ;

would it do the same job ?

Thanks.

Fred
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140209/e7720f18/attachment.html>


More information about the fpc-pascal mailing list