[fpc-devel] Feature request/discussion - SetLengthNoInit
J. Gareth Moreton
gareth at moreton-family.com
Tue Sep 15 17:34:55 CEST 2020
You all make good points. It's why I didn't suggest changing SetLength
because of the well-defined and safe behaviour, and yes, the System unit
is already crowded with intrinsics, and will become even more crowded
once the naming format of the assembly intrinsics are finalised. The
optional parameter (or a new intrinsic) wouldn't change anything that
already exists, and can be documented.
I'm willing to settle with SetLength(array, len, ... len, NoInit:
Boolean = False), but of course it depends on the overall support for
it, which isn't looking too promising currently!
Gareth aka. Kit
On 15/09/2020 10:11, Sven Barth wrote:
> J. Gareth Moreton via fpc-devel <fpc-devel at lists.freepascal.org
> <mailto:fpc-devel at 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
>
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20200915/2725046a/attachment.htm>
More information about the fpc-devel
mailing list