structure layout in C (Eric Muller)
Mon, 11 May 1992 18:04:10 GMT

          From comp.compilers

Related articles
structure layout in C (1992-05-11)
Re: structure layout in C (1992-05-13)
Re: structure layout in C (1992-05-13)
Re: structure layout in C (1992-05-15)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (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,
[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]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.