Article View: comp.std.c
Article #91Re: int foo[]; vs. extern int foo[];
From: T. William Wells
Date: Wed, 05 Aug 1992 12:20
Date: Wed, 05 Aug 1992 12:20
35 lines
2063 bytes
2063 bytes
In article <14383@ksr.com> jfw@ksr.com (John F. Woods) writes:
: "A declaration of an identifier for an object that has file scope without an
: initializer, and without a storage-class specifier or with the storage-class
: specifier *static*, constitutes a _tentative_definition_. If a translation
: unit contains one or more tentative definitions for an identifier, and the
: translation unit contains no external definition for that identifier, then
: the behavior is exactly as if the translation unit contains a file scope
: declaration of that identifier, with the composite type as of the end of the
: translation unit, with an initializer equal to 0.
This is the wording in the draft.
: 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.
: but I think the clarification
: under "Semantics" in 3.5.7 ("If an object that has static storage duration
: is not initialized explicitly, it is initialized implicitly as if every
: member that has arithmetic type were assigned 0 and every member that has
: pointer type were assigned a null pointer constant.") adequately blesses
: the necessary interpretation.
Unfortunately not. 3.7.2 implies that the behavior is as if there
was an explicit declaration and so this section does not apply.
So, I think that this one remains unresolved. However, I'm leaning
towards a literal interpretation, which requires that this be an
error.
---
Bill { uunet | decwrl | telesci }!twwells!bill
bill@twwells.com
Technical Details
Message-ID:
<BsIFLn.6IH@twwells.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!twwells!billReferences:
<Bs938o.54A@twwells.com> <14383@ksr.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: <Bs938o.54A@twwells.com> <14383@ksr.com> Message-ID: <BsIFLn.6IH@twwells.com> Date: Wed, 5 Aug 1992 12:20:06 GMT Lines: 35