Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!sun-barr!decwrl!decvax!ima!compilers-sender From: aglew@mcdurb.Urbana.Gould.COM Newsgroups: comp.compilers Subject: Re: Layout of Structs Message-ID: <4045@ima.ima.isc.com> Date: 4 Jun 89 19:34:00 GMT References: <4002@ima.ima.isc.com> Sender: compilers-sender@ima.ima.isc.com Reply-To: aglew@mcdurb.Urbana.Gould.COM Lines: 24 Approved: compilers@ima.UUCP 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] -- Send compilers articles to compilers@ima.isc.com or, perhaps, Levine@YALE.EDU Plausible paths are { decvax | harvard | yale | bbn}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request