Article View: comp.std.c
Article #17Re: arrays of incomplete type elements
From: Larry Jones
Date: Tue, 27 Oct 1992 18:15
Date: Tue, 27 Oct 1992 18:15
38 lines
1878 bytes
1878 bytes
In article <1992Oct27.080515.9088@netcom.com>, rfg@netcom.com (Ronald F. Guilmette) writes:
< I have it on good authority that code such as:
<
< typedef struct struct0 table [500];
<
< struct struct0 {
< int member;
< };
<
< table my_table;
<
< Is valid and permissible because the element type for the array type
< is in fact "completed" prior to the end of the compilation unit.
<
< The claim I have heard made is that one or more of the x3j11 interpretation
< rulings contained in the Technical Information Bulletin #1, supports
< this view.
<
< On the other hand, I find some evidence *against* this view in the
< standard itself. In 3.1.2.5 it says:
<
< "An array type describes a contiguously allocated nonempty set of
< objects with a particular member object type, called the element
< type."
In fact, there's a footnote there (17) which explicitly says "Since
object types do not include incomplete types, an array of incomplete
type cannot be constructed." That sounds like pretty compelling
evidence that the above typedef is, in fact, invalid. I can find no
extant interpretations that address this specific point, only one that
asks about "typedef int foo[];" which is a whole different case since
the base type there is not incomplete, only the resulting array type.
I believe that your example is clearly invalid.
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH 45150-2789 513-576-2070
larry.jones@sdrc.com or ...uunet!sdrc!larry.jones
See, it all makes sense. See? See?? They never see. -- Calvin
Technical Details
Message-ID:
<2175@sdrc.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!sdrc!thor!scjonesReferences:
<1992Oct27.080515.9088@netcom.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sdrc!thor!scjones From: scjones@thor.sdrc.com (Larry Jones) Newsgroups: comp.std.c Subject: Re: arrays of incomplete type elements Message-ID: <2175@sdrc.COM> Date: 27 Oct 92 18:15:53 GMT References: <1992Oct27.080515.9088@netcom.com> Sender: news@sdrc.COM Lines: 38