Article View: comp.std.c
Article #3313Re: Structure walking
From: Norman Diamond
Date: Wed, 27 Jan 1993 01:32
Date: Wed, 27 Jan 1993 01:32
30 lines
2337 bytes
2337 bytes
In article <C1GHJy.GJp@x.co.uk> clive@x.co.uk (Clive Feather) writes: >In article <1993Jan26.013634.20451@nntpd.lkg.dec.com> diamond@jit.dec.com (Norman Diamond) writes: >>In article <1993Jan25.213543.25499@pony.Ingres.COM> mikes@Ingres.COM (Mike Schilling) writes: >>>(a) Each scalar type has an unambiguous alignment requirement. >>For all existing C compilers? Probably. For all hypothetical standard >>conforming compilers? Uncertain. Actually it is imaginable, for a >>hypothetical but really meaningful compiler, if space is virtually free >>but speed is extremely expensive, one might want to align a 4-byte integer >>in the second half of an 8-byte cache line in order to save time by only >>filling half of a cache line. I don't know if you'd call this unambiguous. >ISO 3.1 defines alignment as the requirement for objects of a given type >to have addresses that are multiples of some number. You're right! So does ANSI Classic 1.6. There goes that possible optimization. >There are no >requirements for alignment that I can find, except that 6.5.2.1 requires >the alignment of structure members to be defined by the implementation. That is indeed the (mostly) relevant section, since the original question was asking about structure members. The implementation can choose an arbitrarily obscure alignment technique, as long as it documents it. However, I don't know if that makes it "unambiguous". -- Norman Diamond diamond@jit.dec.com If this were the company's opinion, I wouldn't be allowed to post it. Pardon me? Or do I have to commit a crime first?
Technical Details
Message-ID:
<1993Jan27.013205.21037@nntpd.lkg.dec.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!sdd.hp.com!zaphod.mps.ohio-state.edu!uwm.edu!cs.utexas.edu!sun-barr!ames!decwrl!pa.dec.com!engage.pko.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamondReferences:
<1993Jan25.213543.25499@pony.Ingres.COM> <1993Jan26.013634.20451@nntpd.lkg.dec.com> <C1GHJy.GJp@x.co.uk>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!sdd.hp.com!zaphod.mps.ohio-state.edu!uwm.edu!cs.utexas.edu!sun-barr!ames!decwrl!pa.dec.com!engage.pko.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond From: diamond@jit345.bad.jit.dec.com (Norman Diamond) Subject: Re: Structure walking Message-ID: <1993Jan27.013205.21037@nntpd.lkg.dec.com> Sender: usenet@nntpd.lkg.dec.com (USENET News System) Reply-To: diamond@jit.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo References: <1993Jan25.213543.25499@pony.Ingres.COM> <1993Jan26.013634.20451@nntpd.lkg.dec.com> <C1GHJy.GJp@x.co.uk> Date: Wed, 27 Jan 1993 01:32:05 GMT Lines: 30