Oldham, Adam wrote:
<snip>
"packed record" is the answer.
With it you get
sizeof r1 = 11 r1 = 309800 r1.r2.f1 = 309802
But gpc denies to give the address of the byte fields r1.b1 r1.b2 r1.r2.f2 with mesages like
test4.pas:30: cannot take address of bitfield `B1'
The reason is that gpc aims to be valid for every platform, and that on some there do not exists 8 bits bytes: odd, but we had in Grenoble the case of a CDC machine which had 9 bits bytes ! Thus byte is declared as a 8 bits bitfield for every machine, and on such a CDC machine it was not aligned along an addressable byte boundary, whence the message !
Now sizeof r1 = 11 is the correct answer, and your old machine padded an extra byte to give 12, or may be it had 2 bytes for enum1. gpc packs enum1 on a single byte, and this is the answer to your second question !
See the program packdemo.pas in the demos directory of gpc.
Maurice