Indefinite-length array as member of struct: how?

Walter Murray walter at hpclwjm.HP.COM
Wed Jul 12 03:17:35 AEST 1989


William Davidsen writes:

  [Quotes from dpANS about structure members being allocated "sequentialy"]

>   Although I can't imagine anyone implementing this incorrectly,
> neighther section says anything about "increasing" sequence, just that
> the allocation is sequential.

But the dpANS does provide such a guarantee, in 3.5.2.1:

   "Within a structure object, the non-bit-field members and the
   units in which bit-fields reside have addresses that increase
   in the order in which they are declared."

Also, 3.3.8 requires that a relational test involving pointers 
to members of the same structure will work in the expected way,
with the pointer to the member declared later testing higher.

Walter Murray
-------------



More information about the Comp.lang.c mailing list