Article View: comp.std.c
Article #1435Re: Order of allocation of fields in a struct?
From: Don Lewine
Date: Thu, 14 Jun 1990 16:11
Date: Thu, 14 Jun 1990 16:11
19 lines
1041 bytes
1041 bytes
In article <1563@diemen.cc.utas.oz> charles@tasis.eecs.utas.edu.au (Charles Lakos) writes: >I wonder if the C standard says anything about the order of allocation of >memory to fields of a struct. Yes. See section 3.1.2.5 and section 3.5.2.1 which says, "Within a structure object ... members have addresses that increase in the order that they are declared. ... There may be unnamed holes within a structure, but not at its beginning, as necessary to achieve the appropriate alignment." >Can I then access the fields of v2 in the following way: > (t1 *) p -> b Yes. Donald Lewine uunet!dg!lewine -OR- uunet!ptech!don -OR- Don_Lewine@dgc.ceo.dg.com
Technical Details
Message-ID:
<521@dg.dg.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!dg!lewineReferences:
<1563@diemen.cc.utas.oz>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!dg!lewine From: lewine@dg.dg.com (Don Lewine) Newsgroups: comp.std.c Subject: Re: Order of allocation of fields in a struct? Message-ID: <521@dg.dg.com> Date: 14 Jun 90 16:11:53 GMT References: <1563@diemen.cc.utas.oz> Reply-To: uunet!dg!lewine (Don Lewine) Organization: Data General, Westboro, MA. Lines: 19