[fpc-pascal] Access Violation When SetLength(DynArray, Value)

Luca Olivetti luca at ventoso.org
Fri Sep 9 09:27:16 CEST 2022


El 8/9/22 a les 16:53, Anthony Walter via fpc-pascal ha escrit:
>  > curious minds want to know: what was the fix?
> 
> In a separate part of the pool table initialization, I was 
> precalculating the midpoints and normals for bumper rails. I had 
> carelessly written this code:
> 
>    for I := 0 to Length(Rails) do
>      RailInit(Rails[I], I);

To avoid this kind of error you can use

    for i:= 0 to High(Rails) do

or even

    for i:= Low(Rails) to High(Rails) do

Bye
-- 
Luca



More information about the fpc-pascal mailing list