This means, then, that initializing a dynamic array means to call
SetLength with the dynamic array variable as a parameter.
In the documentation for the
SetLength procedure, I read this:
In case the length is set to a larger length than the current one, the new elements are zeroed out for a dynamic array.
With this in mind, suppose the following code:
var
A: array of byte;
begin
SetLength(A, 2);
end;
Presumably, the condition "the length is set to a larger length than the current one" is true here--that is, the array pointed to by
A is uninitialized (i.e., length is zero) prior to calling
SetLength. The call to
SetLength specifies that the dynamic array holds two elements (larger than the previous number which was zero)--which means, then that the dynamic array now holds two zero bytes.
Is my understanding correct?