AllRecs := Default(TAllRecs)?
Bart
What do you mean? I gave error and warning free examples... I do not think your suggestion is enough, but it would shorten the code for the above question.
In this case that would work, but I suggest to do it on a per record var basis is defensive programming.
Furthermore it does not get rid of the warnings, Bart...
Howardpc hides them, you reintroduce them, I fixed them...
Bad code example:{$mode delphi}{$H+}
type
TRec = record
f1: String;
f2: String;
f3: String;
end;
TRecArray = Array of TRec;
TAllRecs = Record
RecAs: TRecArray;
RecBs: TRecArray;
RecCs: TRecArray;
end;
var
A,B,C:TRec;
D:TAllRecs;
begin
D:= Default(TAllRecs);
A:=B;
B:=C;
end.
Warnings.....:
recinit.pas(22,6) Warning: (5090) Variable "B" of a managed type does not seem to be initialized
recinit.pas(23,6) Warning: (5090) Variable "C" of a managed type does not seem to be initialized.
Now my opinion is to avoid the warnings and not hide them or let them show up. I am a great fan of -Sew