Re: Layout of Structs

aglew@mcdurb.Urbana.Gould.COM
4 Jun 89 19:34:00 GMT

          From comp.compilers

Related articles
Layout of Structs jac@paul.rutgers.edu (1989-05-28)
Re: Layout of Structs henry@zoo.toronto.edu (1989-05-31)
Re: Layout of Structs jac@paul.rutgers.edu (1989-06-02)
Re: Layout of Structs aglew@mcdurb.Urbana.Gould.COM (1989-06-04)
| List of all articles for this month |

From: aglew@mcdurb.Urbana.Gould.COM
Newsgroups: comp.compilers
Date: 4 Jun 89 19:34:00 GMT
References: <4002@ima.ima.isc.com>
Nf-Id: #R:ima.ima.isc.com:4002:mcdurb:35300003:000:937
Nf-From: mcdurb.Urbana.Gould.COM!aglew Jun 4 14:34:00 1989

>> Case in point: on a 68020, are longs 16-bit aligned or 32-bit aligned?
>> Compilers differ.
>
>The 68020 has a 32 bit data path. One would assume (hope?) that the compiler
>would be smart enough to lay out the long on a 32 bit boundry to prevent
>the additional bus cycle.


On Motorola SYSTEM V/68 the compiler normally lays out scalar 32 bit
quantities (ints, etc.) on 32 bit boundaries. This behaviour is controlled
by an environment varaible DBLALIGN, which is normally on. (DBL because
32 bits is a "double-word" in 68K speak).


However, 32 bit fields within structures are normally laid out on 16 bit
boundaries, for compatibility with pre-68020 data structures - all these
data files that have 32 bit quanties at 16 bit alignments. This behaviour
is controlled by a variable STALIGN, which is normally off. Setting STALIGN
gets you a performance boost for your own code, but may not be compatible
with system headers, etc.
[From aglew@mcdurb.Urbana.Gould.COM]
--


Post a followup to this message

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