[fpc-pascal] Copying array raising exception

Joao Morais post at joaomorais.com.br
Sat Jan 26 12:25:21 CET 2008


Joao Morais wrote:
>   writeln('now testing dynamic array');
>   setlength(v1, 5);
>   v2 := copy(v1, 2, 10);
>   writeln('length is: ', length(v2));
>   v2 := copy(v1, 6, 10);         //  <<-- here
>   writeln('length is: ', length(v2));
> end.
> 
> will raise an exception, range check error iirc, trying to copy an array 
> beyond the number of its items. Just to know if this was designed or I 
> should report to mantis.

Remember.

FYI I can survive with this behavior, it was reported because it isn't 
consistent with Delphi.

--
Joao Morais



More information about the fpc-pascal mailing list