🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #129

Re: int foo[]; vs. extern int foo[];

#129
From: Clive Feather
Date: Mon, 10 Aug 1992 13:33
44 lines
2133 bytes
In article <1948@sdrc.COM> scjones@thor.sdrc.com (Larry Jones) writes:
>In article <BsIFLn.6IH@twwells.com>, bill@twwells.com (T. William Wells) writes:
>> : I suppose it might be considered a problem that 3.7.2 specifies that the
>> : initializer is "equal to 0", which might or might not be seen as equal to
>> : "{0}" as is necessary to initialize an array,
>> 
>> That is exactly the problem.
>
> I remember discussing this issue, so it's probably the subject of
> an interpretation request.  The committee's position was that that
> statement specifies the value of the initializer, not the actual
> syntax which would appear in the source to achieve it.

RFI#11 Q3: "The X3J11 committee unanimously agreed that this statement
describes an effect and not a literal token sequence."

Thus the tentative declaration:

    int i [10];

is implicitly completed as:

    int i [10] = { 0 };

However, in Q4, it was asked:

    If one writes the file-scope declaration
        int i [];
    then 3.7.2 suggests that at the end of the translation unit the
    implicit declaration
        int i [] = { 0 };
    or equivalently
        int i [1] = { 0 };
    appears. This seems peculiar, since 3.7.2 specifically forbids this
    case for internally linked identifiers.

The committee stated that this did actually make the dimension 1, even
though it seems to me to contradict the previous decision: "this statement
describes an effect and not a literal token sequence."
-- 
Clive D.W. Feather     | IXI Limited         | If you lie to the compiler,
clive@x.co.uk          | 62-74 Burleigh St.  | it will get its revenge.
Phone: +44 223 462 131 | Cambridge   CB1 1OJ |   - Henry Spencer
Fax:   +44 223 462 132 | United Kingdom      |
Technical Details
Message-ID: <1992Aug10.133311.7650@x.co.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!acorn!ixi!clive
References: <14383@ksr.com> <BsIFLn.6IH@twwells.com> <1948@sdrc.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!acorn!ixi!clive
From: clive@x.co.uk (Clive Feather)
Newsgroups: comp.std.c
Subject: Re: int foo[]; vs. extern int foo[];
Message-ID: <1992Aug10.133311.7650@x.co.uk>
Date: 10 Aug 92 13:33:11 GMT
References: <14383@ksr.com> <BsIFLn.6IH@twwells.com> <1948@sdrc.COM>
Organization: IXI Limited, Cambridge, UK
Lines: 44