Xref: utzoo comp.std.c:4541 comp.std.c++:787 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!hsdndev!spdcc!dirtydog!karl From: karl@ima.isc.com (Karl Heuer) Newsgroups: comp.std.c,comp.std.c++ Subject: Re: Definition With Incomplete Type Should Be An Error Message-ID: <1991Mar28.014240.25561@ima.isc.com> Date: 28 Mar 91 01:42:40 GMT Article-I.D.: ima.1991Mar28.014240.25561 References: <509f2397.20b6d@apollo.HP.COM> Sender: usenet@ima.isc.com Reply-To: karl@ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 25 In article <509f2397.20b6d@apollo.HP.COM> blodgett@apollo.HP.COM (Bruce Blodgett) writes: >Are my comments about the following program correct? I feel that that >the declarations of s1 and a2 should ideally require a diagnostic. When you cross-post an article like this, you should include a warning that you're doing so. My comments apply to ANSI C, not C++. >static int s1[]; /* Violates a "shall" requirement: */ Last time this came up, the conclusion was that, yes, this is illegal. Personally, I think the Standard should have said that this is a declaration rather than a tentative definition, and so it would only produce an error if no actual definition is encountered. (It would also have been nice if Dennis had used keywords to distinguish declarations from definitions in the first place, so we wouldn't need this tentative-definition kludge. But there's no point in dwelling on that.) >extern void main(void) { > auto int a2[]; /* Undefined behavior? */ >} Sounds right to me. You've also misdeclared |main|, though; the Standard says its return type is |int|, not |void|. Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint