On Wed, 12 Apr 2017, Jürgen Hestermann wrote:
Am 2017-04-12 um 16:17 schrieb Ryan Joseph:> SetLength resizes the array in memory and “clear” means setting all values to default() for that type."clear" is not very clear to me ;-) IMO SetLength(array,0) is clearing too. The function you want should be called "Fill". For example a function Array.Fill(DefaultValue); 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); ?
I would think Nil is the only option here, ArrayB is an array of arrays Michael.
_______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
