Tentative defs, type compatibility.

Doug Gwyn gwyn at smoke.BRL.MIL
Sat May 27 03:48:22 AEST 1989


In article <754 at scaup.cl.cam.ac.uk> am at cl.cam.ac.uk (Alan Mycroft) writes:
>Consider the following dpANS C program:
>   int x[10];
>   int x[] = { 1,2 };

>Does the x[10] and x[] get unified together before the initialisation of
>x[10] to {1,2,0,0,...} or does the initialisation of x to (int[2]){1,2}
>happen first and cause a type conflict with x[10]?

The technical question about the wording in the Standard comes down to,
is "x" in the second declaration an "array of unknown size"?  I think
we would agree that IN THAT DECLARATION it has an INCOMPLETE TYPE, but
I think its SIZE is known anyway since by the wording about tentative
definitions both declarations refer to the same object, and the size is
known after the first declaration.

Personally I'm not too happy about the identifier having incomplete
type even though its size if already known, but it doesn't seem to
cause any technical problems.

DISCLAIMER:
This is, of course, not an official X3J11 ruling on the question.
I suggest you submit this to X3J11 as a request for interpretation.



More information about the Comp.std.c mailing list