Variable structure size -- ANSI ?
Rogue Winter
rogue at cellar.UUCP
Sun Apr 14 08:23:35 AEST 1991
willcr at bud.sos.ivy.isc.com (Will Crowder) writes:
> The ANSI standard guarantees that elements of a structure will be allocated
> in the order declared. However, there may be any amount of padding between
> structure elements. But yes, for
>
> struct foo {
> int a;
> int b;
> };
>
> &foo.b is guaranteed to be greater then &foo.a. Also, &foo is guaranteed
> to be equal to &foo.a.
>
Just a quick follow-up question: while
struct foo
{ short a;
short b;
}
is guaranteed to produce &b > &a, will
struct bar
{ short a,b; }
also be guaranteed, or will the pointer order be compiler-dependent?
Rogue Winter : "How can you say I only protected people in South
rogue at cellar.uucp : Philadelphia? I protected people all over this city; it
uunet!cellar!rogue: didn't matter if they were in South Philadelphia or
Cellar 215/3369503: Northeast Philadelphia." -- Frank Rizzo, 4/12/91
More information about the Comp.lang.c
mailing list