[fpc-devel] Feature request/discussion - SetLengthNoInit

Michael Van Canneyt michael at freepascal.org
Tue Sep 15 07:05:18 CEST 2020



On Mon, 14 Sep 2020, J. Gareth Moreton via fpc-devel wrote:

> On 14/09/2020 19:41, Michael Van Canneyt via fpc-devel wrote:
>> Better add an additional (optional) parameter SkipInit : Boolean = False;
>>
>> Michael.
>
> That won't work because constructs such as "var Data: array of array of 
> Byte; SetLength(Data, 25, 25);" are allowed.? Eevn if it's technically 
> an intrinsic and the compiler can have customised handling, I think it 
> will cause too much confusion to have an optional Boolean parameter like 
> that.?

I think adding even more intrinsics to the compiler is really not an option.
The system unit is already overcrowded and bloated with intrinsics, 
so adding even more for what is at best a real corner case: 
I really don't think that's a good idea.

If speed matters so much to some people, don't use setlength(), use getmem().

Michael.


More information about the fpc-devel mailing list