Adriaan van Os wrote:
Looking into this further, the cause seems to be a curious miscalculation of record sizes.
program prog;
type pv1 = record x, y: Extended; v: array[1..2] of Boolean; end; pv2 = packed record x, y: Extended; v: array[1..2] of Boolean; end; pv3 = record x, y: Extended; end; pv4 = packed record x, y: Extended; end; pv5 = record v: array[1..2] of Boolean; end; pv6 = packed record v: array[1..2] of Boolean; end;
<snip>
sizeof(pv1) = 48 sizeof(pv2) = 34 sizeof(pv3) = 32 sizeof(pv4) = 32 sizeof(pv5) = 2 sizeof(pv6) = 2
Why do you think that sizes are miscalculated? On my Linux box I get the same result and explanation is simple: to get correct alignment Extended uses 16 bytes (only 10 are really used, the rest is just padding). That explains size of pv3 and pv4. pv1 must be aligned to 16 bytes, so we must round up the size to 48 bytes. pv2 is packed, so final padding is skipped, and we get 34.
So, it looks OK (assuming that C compiler on Mac OSX gives you 16 as the size for 'long double').