#### View Issue Details

ID Project Category View Status Date Submitted Last Update 0033759 FPC Documentation public 2018-05-18 15:15 2019-02-15 16:38 Sven Barth Michael Van Canneyt normal minor N/A closed fixed 3.1.1 3.2.0 3.1.1 0033759: Document SetLength() for multi dimensional dynamic arrays Current it is not explicitely documented that SetLength() for dynamic arrays can take multiple length arguments to create a "rectangular"* multi dimensional array. E.g. SetLength(arr, 10, 20), to create a dynamic array with 10 elements whereby each contains a dynamic array with 20 elements. Of course it should also be documented that multi dimensional dynamic arrays don't need to be "rectangular"*. So something like this would be valid as well: === code begin === var   a: array of array of array of LongInt;   i, j, k: LongInt; begin   SetLength(a, 10, 5);   SetLength(a[5], 3);   for i := Low(a) to High(a) do     for j := Low(a[i]) to High(a[i]) do begin       SetLength(a[i, j], i * 10 + j);       for k := Low(a[i, j]) to High(a[i, j]) do         a[i, j, k] := i * 10000 + j * 100 + k;     end;   for i := Low(a) to High(a) do begin     for j := Low(a[i]) to High(a[i]) do begin       for k := Low(a[i, j]) to High(a[i, j]) do         Writeln(a[i, j, k]);       Writeln('-------');     end;     Writeln('=======');   end; end. === code end === * "rectangular" is written in quotes as arrays with more than three dimensions aren't rectangles of course. ;) No tags attached. 1490 0 Attached Files

#### Activities

 2018-06-28 11:04 administrator   ~0109102 Adapted setlength documentation for multi-dimensional case, added a couple of paragraphs to the dynamic arrays section of the reference manual, including your example. Many thanks! 2019-02-15 16:38 manager   ~0114154 Thanks!