🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #6061

Re: Tentative defs, type compatibility.

#6061
From: Doug Gwyn
Date: Fri, 26 May 1989 17:48
23 lines
1496 bytes
In article <754@scaup.cl.cam.ac.uk> am@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.
Technical Details
Message-ID: <10330@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!ncar!ames!haven!adm!smoke!gwyn
References: <754@scaup.cl.cam.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!ncar!ames!haven!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: Tentative defs, type compatibility.
Message-ID: <10330@smoke.BRL.MIL>
Date: 26 May 89 17:48:22 GMT
References: <754@scaup.cl.cam.ac.uk>
Reply-To: gwyn@brl.arpa (Doug Gwyn)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 23