Basically my issue is that I have to use very often this kind of structure:
type myrecord1=record
aa:array of string;
bb:array of array of integer;
cc:array of boolean;
dd:string;
end;
type myArray=array of myrecord1;
....
....
var
a:myArray;
begin
setLength(a,0);
while mycondition do
begin
setLength(A,length(A)+1);
A[length(A)-1].dd:='Test';
end;
end;
At the moment every time I have to do something like this:
setLength(A,length(A)+1);
setLength(A[length(A)-1].aa,0); //Boring and dangerous line
setLength(A[length(A)-1].bb,0); //Boring and dangerous line
setLength(A[length(A)-1].cc,0); //Boring and dangerous line
A[length(A)-1].dd:='Test';
The "Boring and dangerous lines" are easy sources of bugs.
What I would like to have is that when I do setLength(A,length(A)+1) , every subArray length is set to 0 and not to a random value.
I think that with your code I should obtain this, is it ?