Hi,
I'm against adding support for this. Dynamic arrays have guaranteed
behavior. If users find that this behavior is not appropriate for
their use case then they should not use them (or as you already
suggested, preallocate them).
well, setlength does not always initialize the array
That is why the new fpc versions always show a "might be
uninitialized"-warning, when setlength is called without setting the
array to nil first
Bye,
Benito
On 15.09.2020 11:11, Sven Barth via fpc-devel wrote:
J. Gareth Moreton via fpc-devel <fpc-devel@lists.freepascal.org
<mailto:fpc-devel@lists.freepascal.org>> schrieb am Mo., 14. Sep.
2020, 19:00:
With all this in mind, would there be support for an intrinsic
such as
"SetLengthNoInit" or "SetLengthNoClear" or some similar name that has
all the benefits of SetLength (especially the reference counting) but
doesn't initialise new elements to zero? If I'm learning one
thing, Free
Pascal is finding a niche in some scientific applications, and
speed can
be essential sometimes.
I'm against adding support for this. Dynamic arrays have guaranteed
behavior. If users find that this behavior is not appropriate for
their use case then they should not use them (or as you already
suggested, preallocate them).
Regards,
Sven
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel