Zero Length Arrays Allowed in C Standard?DOWN

Chris Torek chris at mimsy.umd.edu
Sat Dec 9 04:53:59 AEST 1989


In article <70691 at psuecl.bitnet> c9h at psuecl.bitnet writes:
>Am I overlooking something, or is storage order actually undefined?

Storage allocation order in general is left to the implementation, but
some things are specified.  In particular, structure members must be
allocated in order, possibly leaving gaps.  That is, a compiler cannot
take something like

	struct foo {
		int	a;
		char	b;
		double	c;
		char	d;
	};

and `rearrange' it to the order c/a/b/d, even if that would cause the
structure to fit in nearly half as much space.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list