[fpc-pascal] Are record fields zeroed on declaration of a record?

Bo Berglund bo.berglund at gmail.com
Thu Oct 8 10:43:40 CEST 2020


I would like to know if data containers of type packed record are
zeroed when the item is declared?

type
  TMyRecord = packed record
    AField1: byte;
    AField2: word;
    AField3: single;
    AField4: boolean;
    AField5: array[0..15] of Cardinal;
  end;

procedure SomeProc;
var
  myRec: TMyRecord;
begin
 ...

Will random data fill myRec until I assign each field or will the
entire record be zeroed at this point?


-- 
Bo Berglund
Developer in Sweden



More information about the fpc-pascal mailing list