Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!sdrc!scjones From: scjones@sdrc.UUCP (Larry Jones) Newsgroups: comp.lang.c Subject: Re: Overzealous alignment and padding Summary: Clarification Message-ID: <411@sdrc.UUCP> Date: 17 Oct 88 21:48:34 GMT References: <410@sdrc.UUCP> Organization: Structural Dynamics Research Corp., Cincinnati Lines: 33 In article <410@sdrc.UUCP>, I wrote: > I am looking for information about C compilers that are overzealous > about aligning structure members and padding structures. By this > I mean that the compiler aligns more strictly than is required by > the underlying hardware - for example, aligning an array of char > on an int boundary rather than a char boundary. Similarly, a > structure may be padded out to an even number of ints even though > all the members are only char. Well, I've been inundated by the first wave of replies saying "LOTS of compilers do this!" which means I didn't make myself clear and, sure enough, as I reread what I said, not only did I not make myself clear, I didn't say what I meant at all! What I'm interested in knowing about is NOT compilers that align more strictly than the hardware requires, but rather compilers that align more strictly in some cases than in others. For example, if a compiler chooses to align char on a multiple of 1, short on a multiple of 2, and long on a multiple of 4, that's OK by me. If, however, it further aligns char arrays or char structure members on a multiple of 2 or 4 (even though char is only aligned on a multiple of 1), THAT'S what I want to know about (particularly if there's no way to disable it). So far, the only compilers I know of that behave this way is the Microsoft V4 (and related Xenix) compiler (which had a switch to disable it), and the Apollo compiler (which does not). ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC scjones@sdrc.uucp 2000 Eastman Dr. BIX: ltl Milford, OH 45150 AT&T: (513) 576-2070 "Save the Quayles" - Mark Russell