学习结构[记录]类型(2) - 压缩结构

type
  TRec1 = record
    i: Integer;
    w: Word;
  end;

  TRec2 = packed record {压缩结构: 牺牲效率, 减小尺寸}
    i: Integer;
    w: Word;
  end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(IntToStr(SizeOf(TRec1))); {8}
  ShowMessage(IntToStr(SizeOf(TRec2))); {6}
end;

 

你可能感兴趣的:(学习)