Simple questions about array declarations

Karl Heuer karl at haddock.ima.isc.com
Wed Feb 28 08:36:23 AEST 1990


In article <12235 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>-	static int array7[];    static int array7[3] = { 1,2,3 };
>-	static int array8[3];   static int array8[3] = { 1,2,3 };
>-	static int array9[3];   static int array9[] = { 1,2,3 };
>-	static int array10[];   static int array10[] = { 1,2,3 };
>
>All these are okay.

That's what I thought, too, but when Ron said (in email) that gcc didn't like
them all, I checked the ANS.  3.7.2 says "if the declaration... is a tentative
definition and has internal linkage, the declared type shall not be an
incomplete type".  This seems to make array7 and array10 illegal.

It's also a pretty stupid rule, in my opinion.

Karl W. Z. Heuer (karl at ima.isc.com or harvard!ima!karl), The Walking Lint



More information about the Comp.std.c mailing list