[fpc-pascal] Access Violation When SetLength(DynArray, Value)
Luca Olivetti
luca at ventoso.org
Fri Sep 9 15:29:01 CEST 2022
El 9/9/22 a les 14:58, James Richters via fpc-pascal ha escrit:
> Is there some nifty way to increase a dynamic array by 1 that is more
> elegant?
> Inc(MyArray); would sure be nice
If I know that I have to regularly add a single element to an array,
instead of using a dynamic array I just use a TFPGList (if the elements
are simple types or records) or a TFPGObjectList (if the element are
objects and I want automatic housekeeping) from the fgl unit, then I can
just do MyList.Add(element).
I don't know if it is more or less efficient than using a dynamic array
but I think it's nicer.
There are other generic classes that may be more efficient than fgl but
I'm just used to fgl.
Bye
--
Luca
More information about the fpc-pascal
mailing list