<div dir="auto"><div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Peter Blackman via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Di., 20. Okt. 2026, 23:51:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 19/10/2026 01:45, P Padil via fpc-pascal wrote:<br>
> I set a small array and the program below is ok to go out of bounds.<br>
> <br>
> —<br>
> program test;<br>
> <br>
> type<br>
>     tarr = array of array of boolean;<br>
> <br>
> var<br>
>    exa : tarr = ((false,false,true,true),(false,false,true,true),<br>
>    (true,true,false,true), (true,true,true,false));<br>
> <br>
> begin<br>
>    writeln(exa[0,0],', ',exa[4,4]);<br>
>    writeln(low(exa),', ',high(exa));<br>
>    writeln(low(exa[4]),', ',high(exa[4]));<br>
> end.<br>
As its a dynamic array, I would use SetLength on it,<br>
before assigning to its elements.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">The array is already initialized with the initialization directly following its declaration. A SetLength() is not necessary in that case. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>