Article View: comp.std.c
Article #138Re: int foo[]; vs. extern int foo[];
From: T. William Wells
Date: Mon, 10 Aug 1992 20:39
Date: Mon, 10 Aug 1992 20:39
35 lines
1914 bytes
1914 bytes
In article <1992Aug6.204924.15646@crd.ge.com> volpe@ausable.crd.ge.com writes:
: In article <BsIFLn.6IH@twwells.com>, bill@twwells.com (T. William Wells) writes:
: |>
: |> So, I think that this one remains unresolved. However, I'm leaning
: |> towards a literal interpretation, which requires that this be an
: |> error.
:
: So, then "int foo[5];" should be an error if seen at the file scope
: level without an initialized definition elsewhere in the translation
: unit? If so, I think there's a lot of broken code and broken compilers
: out there.
I realized that that just after I posted. :-) I've now concluded
that the standard is just plain broken here. Rather obviously,
they didn't intend to invalidate that sort of code.
Since the wording doesn't say what they meant I'm no longer
willing to guess what they intended. For example, they might have
meant that the thing should have been initialized to {0} or they
might have meant that every element of the object be initialized
to zero as per the rules in the relevant section. Those have
different results, the one being that int foo[]; is valid and
creates an array of one element; the other being that int foo[] is
invalid. Or maybe they just forgot that case and intended
something different.
However, the list of interpretations you posted covers this:
RFI 11 Q 4 3.7.2 one implicit initializer supplied for incomplete extern
So, the effect is as if {0}.
---
Bill { uunet | decwrl | telesci }!twwells!bill
bill@twwells.com
Technical Details
Message-ID:
<BssC2K.A6w@twwells.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!twwells!billReferences:
<14383@ksr.com> <BsIFLn.6IH@twwells.com> <1992Aug6.204924.15646@crd.ge.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!twwells!bill From: bill@twwells.com (T. William Wells) Subject: Re: int foo[]; vs. extern int foo[]; Organization: None, Mt. Laurel, NJ References: <14383@ksr.com> <BsIFLn.6IH@twwells.com> <1992Aug6.204924.15646@crd.ge.com> Message-ID: <BssC2K.A6w@twwells.com> Date: Mon, 10 Aug 1992 20:39:53 GMT Lines: 35