🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3

arrays of incomplete type elements

#3
From: Ronald F. Guilmette
Date: Tue, 27 Oct 1992 08:05
49 lines
2380 bytes
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."

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.

Can anyone provide additional relevant information which bears on this issue?
Does anyone find anything relevant in TIB #1?  If so, where?

P.S.  It is definitely *not* relevant to my primary question (which is
only concerned with what the standard itself says) but I *am* curious
if any supposedly "ANSI conformant" compilers out there reject the code
sample shown above.  It would also be an interesting test to try to
move the definition of `struct struct0' down *below* the declaration of
`my_table' and then see what various compilers think of the example.

-- 

// Ron ("Loose Cannon") Guilmette
// uucp: ...uunet!lupine!segfault!rfg
// New new motto:  Quality control is a state of mind.
//   misc.forsale.computers ad, circa 2007:
//       Used Cray wrist watch for sale; 25 bucks or best offer.
Technical Details
Message-ID: <1992Oct27.080515.9088@netcom.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!rfg

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!rfg
From: rfg@netcom.com (Ronald F. Guilmette)
Subject: arrays of incomplete type elements
Message-ID: <1992Oct27.080515.9088@netcom.com>
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Tue, 27 Oct 1992 08:05:15 GMT
Lines: 49