Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!decwrl!decvax!ima!compilers-sender From: jac@paul.rutgers.edu (J. A. Chandross) Newsgroups: comp.compilers Subject: Layout of Structs Keywords: symbol tables, offsets, psects, real-time monitor Message-ID: <3992@ima.ima.isc.com> Date: 28 May 89 02:06:27 GMT References: <3979@ima.ima.isc.com> Sender: compilers-sender@ima.ima.isc.com Reply-To: jac@paul.rutgers.edu (J. A. Chandross) Distribution: na Organization: Rutgers Univ., New Brunswick, N.J. Lines: 32 Approved: compilers@ima.UUCP stein@pixelpump.osc.edu (Rick 'Transputer' Stein) > I have some questions about how a compiler constructs a symbol table. > [questions on structure layout deleted] Our erstwhile moderator replies: > C compilers have the right to lay out structures any way they see fit, > unless the ANSI committee changed the rules. I quote, without permission, from The Bible, page 196, First Edition: "Within a structure, the objects declared have addresses which increase as their declarations are read lef-to-right. Each non-field member of a structure begins on an addressing boundry appropriate to its type; therefore, there may be unnamed holes in a structure. Field members are packed into machine integers; they do not straddle words. A field which does not fit into the space remaining in a word is put into the next word....." It is a Good Thing [tm] that structures are laid out in this way. As a hardware type, I often need to write device drivers. Being able to impose a structure onto a hardware memory map is a very useful thing, indeed. Jonathan A. Chandross Internet: jac@paul.rutgers.edu UUCP: rutgers!paul.rutgers.edu!jac [I hope I'm not the erstwhile moderator yet, but stand corrected. -John] -- 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