[fpc-devel] Feature request/discussion - SetLengthNoInit

Michael Van Canneyt michael at freepascal.org
Wed Sep 16 16:28:18 CEST 2020

On Wed, 16 Sep 2020, Benito van der Zander via fpc-devel wrote:

> 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

Of course it does.

> 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

That is because you pass it an uninitialized array, not because SetLength()
possibly would not do something.


More information about the fpc-devel mailing list