
testrec = packed record
case Integer of
0: (shi:Shortint);
1: (b:Byte);
2: (smi: Smallint);
3: (w: WORD);
4: (i: Integer);
5: (dw:DWORD);
6: (buff : array[0..3] of Byte);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
a : testrec;
begin
a.i := -1;
ShowMessage(IntToStr(a.shi));// -1
ShowMessage(IntToStr(a.b));// -1
ShowMessage(IntToStr(a.smi));// -1
ShowMessage(IntToStr(a.w));// -1
ShowMessage(IntToStr(a.i));// -1
ShowMessage(IntToStr(a.dw));// 4294967295
end;
case Integer of
0: (shi:Shortint);
1: (b:Byte);
2: (smi: Smallint);
3: (w: WORD);
4: (i: Integer);
5: (dw:DWORD);
6: (buff : array[0..3] of Byte);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
a : testrec;
begin
a.i := -1;
ShowMessage(IntToStr(a.shi));// -1
ShowMessage(IntToStr(a.b));// -1
ShowMessage(IntToStr(a.smi));// -1
ShowMessage(IntToStr(a.w));// -1
ShowMessage(IntToStr(a.i));// -1
ShowMessage(IntToStr(a.dw));// 4294967295
end;