Unless you specify "packed record", a record will align to the nearest 
multiple of 8 for speed purposes.  You can specify the alignment in the 
Compiler Options under Project Options.

Regards,
Ross.

----- Original Message ----- 
From: "Delphi _sloHOST_" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, February 13, 2006 8:30 PM
Subject: SizeOf() not working


I don't understand something...

When defining record rrr:
type rrr=record
          a:word;
          b:string[20];
          c:boolean;
          reserve:string[100];
         end;
var sss:rrr;

...and geting SizeOf(sss) I get: 126

When redefining record rrr to (adding variable d:real - it is 8-byte 
long,
and subtracting length of string variable by 8):
type rrr=record
          a:word;
          b:string[20];
          c:boolean;
          d:real;
          reserve:string[92];
         end;
var sss:rrr;

...and geting SizeOf(sss) I get: 128

but I should get 126?!...or not?!?!?

Thanx for all the answers... Aris.

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to