> On Apr 12, 2017, at 9:43 PM, Jürgen Hestermann <[email protected]>
> wrote:
>
> "clear" is not very clear to me ;-)
> IMO SetLength(array,0) is clearing too.
SetLength resizes memory so there’s that distinction. The fact there is an API
is what’s important because there’s at least a reference point.
>
> The function you want should be called "Fill".
> For example a function
>
> Array.Fill(DefaultValue);
Good idea. Any defined function is preferable.
>
> But what happens to a multi-dimensional (dynamic) array?
> For example, how to handle this case:
>
> Type MyType = record
> A : Integer;
> B : array of char;
> C : array of Float;
> end; // of record
> ArrayA = array of MyType;
> ArrayB = array of ArrayA.
>
> What would be the DefaultValue for
>
> ArrayB.Fill(DefaultValue);
That’s one of the reasons we won’t be seeing this function any time soon. ;)
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal