Most computers restrict shorts and integer accesses to be “aligned”. A short must start at an even address and a integer must start at an address that is a multiple of 4.
so:
So if you cluster your bytes, 4 of them take as much space as 1 integer.
so:
Type aType Field a:Int Field b1:Byte Field b2:Byte Field b3:Byte Field b4:Byte Field c:Int EndType Print SizeOf( New aType)It's still 12
Type aType Field b1:Byte Field a:Int Field b2:Byte Field c:Int Field b3:Byte Field b4:Byte EndType Print SizeOf( New aType)It's 18
So if you cluster your bytes, 4 of them take as much space as 1 integer.