[comp.std.c] when is the size of a type needed?

henry@zoo.toronto.edu (Henry Spencer) (01/06/91)

Could some kind soul who is on the mailing list for X3J11's interpretation
phase respond to a question that was asked, and not answered, early in the
autumn:  when is the size of a type needed?  3.5.2.3 says that an incomplete
struct/union type can be used "only when the size of an object of the
specified type is not needed".  If I recall correctly, it was reported that
an interpretation request for this was answered by saying roughly, "this
means when it is required by the standard, not when it is needed by a
particular implementation".  I would very much like to see the exact
wording of this interpretation, and any supporting references, because
with the sole exception of sizeof, the standard makes no such requirement,
dammit!

There *are* certain circumstances when a type is required to be an object
type, which excludes any form of incomplete type.  But when incomplete
types are admissible, there is no indication of whether "the size of an
object of the specified type" is needed.

1.6 is most explicit that "the omission of any explicit definition of
behavior" means that the behavior is undefined, i.e. "the standard
imposes no requirements".
-- 
If the Space Shuttle was the answer,   | Henry Spencer at U of Toronto Zoology
what was the question?                 |  henry@zoo.toronto.edu   utzoo!henry