alignment on a VAX (structure member ordering)

Gary M. Samuelson garys at bunker.UUCP
Sat Mar 30 02:11:02 AEST 1985


> It appears to me that packed structures are even jumping the gun.
> Does the C language even define the order in which the elements of
> a structure are placed in memory? The chapter on structures in K&R
> only states that the structure is a grouping of data items and I
> failed to find any statements about ordering of the elements.  Am
> I mistaken about this?

Yes, you are mistaken.  In K&R, appendix A, sec 8.5, p. 196:

	Within a structure, the objects declared have addresses
	which increase as their declarations are read left-to-
	right.  Each non-field member of a structure begins on
	an addressing boundary appropriate to its type; therefore,
	there may be unnamed holes in a structure.

Gary Samuelson
ittvax!bunker!garys



More information about the Comp.lang.c mailing list