🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #47

Re: arrays of incomplete type elements

#47
From: Norman Diamond
Date: Mon, 02 Nov 1992 05:00
38 lines
2399 bytes
Apologies if you see this 3 times.  I don't think this escaped from Digital
before, and I can no longer abuse Berkeley's daemon to get things posted.

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."

That describes complete array types.  No problem.

>Given that "object types" is a set of types which is totally disjoint from
>"incomplete types", it seems to me that the typedef statement shown in
>the example above is non-standard-conforming, because it attempts to
>define, specify, or use an array type where the element type is (at that
>point) and incomplete type.

Typedefs are allowed to declare incomplete types.  The typedef in this
example declares an incomplete array type, and the type is completed later.

>I *am* curious if any supposedly "ANSI conformant" compilers out there
>reject the code sample shown above.

The possibility of false assertions by vendors is not a standards issue.
--
Norman Diamond       diamond@jit081.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
"It's been a lovely recession."
Technical Details
Message-ID: <1992Nov2.050021.18705@nntpd.lkg.dec.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!decwrl!pa.dec.com!engage.pko.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond
References: <1992Oct27.080515.9088@netcom.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!decwrl!pa.dec.com!engage.pko.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond
From: diamond@jit345.bad.jit.dec.com (Norman Diamond)
Subject: Re: arrays of incomplete type elements
Message-ID: <1992Nov2.050021.18705@nntpd.lkg.dec.com>
Sender: usenet@nntpd.lkg.dec.com (USENET News System)
Reply-To: diamond@jit.dec.com (Norman Diamond)
Organization: Digital Equipment Corporation Japan , Tokyo
References: <1992Oct27.080515.9088@netcom.com>
Date: Mon, 2 Nov 1992 05:00:21 GMT
Lines: 38