<p>Am 04.04.2017 06:55 schrieb "Ryan Joseph" <<a href="mailto:ryan@thealchemistguild.com">ryan@thealchemistguild.com</a>>:<br>
><br>
><br>
> > On Apr 2, 2017, at 11:02 PM, Sven Barth via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> wrote:<br>
> ><br>
> > can be easily seen by looking at the implementation of SetLength() in<br>
> > $fpcdir/rtl/inc/dynarr.inc, fpc_dynarray_setlength().<br>
> > Especially since line 220 (at least in the current revision) contains a<br>
> > call to FillChar(), the whole ordeal can only be *more* complex than<br>
> > FillChar().<br>
><br>
> That’s good to know about SetLength.<br>
><br>
> Is it possible use FillChar on a multidimensional arrays?<br>
><br>
> arr: array of array of array of integer.<br>
> SetLength(arr, 3, 3, 3);<br>
> FillChar(arr[0], (3*3*3)*sizeof(integer), false);<br>
><br>
> I’m just getting crashes.</p>
<p>That does only work with static arrays as dynamic arrays are in reality managed pointers, thus you override the pointers themselves with your FillChar. Not to mention that you're overwriting the memory behind the outermost array as that only has a size of Length(arr) * SizeOf(Pointer).</p>
<p>Regards,<br>
Sven</p>