[fpc-pascal] Array clearing

Ryan Joseph ryan at thealchemistguild.com
Sat Apr 1 15:09:50 CEST 2017

> On Apr 1, 2017, at 6:31 PM, J├╝rgen Hestermann <juergen.hestermann at gmx.de> wrote:
> I am wondering what the purpose of filling all
> array elements with zero's could be.
> If I want to discard all elements I would simply delete
> the whole array (setlength(MyArray,0) ).

Because the array is being iterated and I need to know which values are set. Basically I have a dynamic array I grow to a certain size and this process happens in a loop. The options are to allocate/free the array every cycle or clear memory and allocate the array once.

	Ryan Joseph

More information about the fpc-pascal mailing list