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

Sven Barth pascaldragon at googlemail.com
Sat Sep 10 00:51:58 CEST 2022


James Richters via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Fr., 9. Sep. 2022, 14:58:

> I still end up with a lot of
> SetLength(MyArray,Length(MyArray)+1);
> Every time I want to add one more thing to the array.
>

With FPC 3.2.0 and newer you can do "Concat(MyArray, [TheNewElement])" or
(if modeswitch ArrayOperators is active) "MyArray := MyArray +
[TheNewElement]".

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20220910/18205f8d/attachment.htm>


More information about the fpc-pascal mailing list