Am 04.04.2017 13:55 schrieb "Ryan Joseph" <r...@thealchemistguild.com>: > > > > On Apr 4, 2017, at 4:58 PM, Howard Page-Clark via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > > > > You can always use FillChar and its kin on specific 'nested' arrays like this > > > > type > > TIntArray = array of Integer; > > TIntIntArray = array of TIntArray; > > TIntIntIntArray = array of TIntIntArray; > > > > procedure FillArray(const anArray: TIntIntIntArray; aValue: DWord); > > var > > x, y: integer; > > begin > > for x:=0 to High(anArray) do > > for y:=0 to High(anArray[x]) do > > FillDWord(anArray[x][y][0], Length(anArray[x][y]), aValue); > > end; > > Doesn’t iterating the array default the purpose of FillChar? The goal was the most efficient way clear the array with zero’s. Even if the array if nested 3 levels deep (anArray[x][y][z]) it should (I hope) be a contiguous block of memory that was allocated (correct me if I wrong please). >
As I wrote that isn't the case. Each dynamic array is allocated independently (and thus you could also resize each subelement independently). If you want continuous memory areas you need to use static arrays or develop your own dynamic data structure that uses array properties. Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal