[fpc-pascal] alignment of records
Luca Olivetti
luca at ventoso.org
Sat Aug 8 10:48:17 CEST 2015
El 08/08/15 a les 09:30, Sven Barth ha escrit:
> Am 08.08.2015 00:37 schrieb "Ralf Quint" <freedos.la at gmail.com
> <mailto:freedos.la at gmail.com>>:
> >
> > On 8/6/2015 8:25 PM, Xiangrong Fang wrote:
> >>
> >> It seems that $packrecord does not work at all.
> >
> > I always explicitly use PACKED Record as in
> >
> > Type ifmap = PACKED Record
> > mem_start: dword;
> > mem_end: dword;
> > base_addr: word;
> > irq: byte;
> > dma: byte;
> > port: byte;
> > end;
> >
> > and at least in/up to FPC 2.6.4, this works for me just fine
>
> This depends however on the code you're interfacing with. Also the
> record you mentioned as an example shouldn't differ with and without
> packed anyway...
With packed the above record is 13 bytes, without is 16 (the bytes are
word aligned).
That's with fpc 2.6.4 x86_64 (though it should be the same with a 32
bits compiler).
Just to be sure, in such cases I also use "packed array" and most of the
times bitpacked records.
Bye
--
Luca
More information about the fpc-pascal
mailing list