| Related articles |
|---|
| structure layout in C muller@src.dec.com (1992-05-11) |
| Re: structure layout in C macrakis@osf.org (1992-05-13) |
| Re: structure layout in C stephen@estragon.uchicago.edu (1992-05-13) |
| Re: structure layout in C bliss@sp64.csrd.uiuc.edu (1992-05-15) |
| Newsgroups: | comp.compilers |
| From: | muller@src.dec.com (Eric Muller) |
| Keywords: | C, question |
| Organization: | DEC Systems Research Center |
| Date: | Mon, 11 May 1992 18:04:10 GMT |
I'd like to find an algorithm to determine the layout of C structure
declarations. This algorithm should be parameterized so that it can
work for as many machines as possible. The algorithm used in GCC
would have been a perfect candidate, if only I could understand it
(without reading all of gcc).
Thanks in advance,
Eric.
[Every compiler I've ever seen aligns each field on its natural boundary
(which on machines like the 286 may be a byte regardless of field size.)
There's a little more variety on arrays of structures, but only two or
three monor variations. Does anyone do something different? As I recall,
ANSI specifically forbids reordering fields to pack them in better. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.