Article View: comp.std.c
Article #2565Re: 3.7 constraints and 3.7.2 semantics
From: Blair P. Houghton
Date: Tue, 19 Mar 1991 04:49
Date: Tue, 19 Mar 1991 04:49
44 lines
2157 bytes
2157 bytes
Didn't this just go around? Or is this the "Now let me
get this straight" version of the question?
In article <5450@mcrware.UUCP> jejones@mcrware.UUCP (James Jones) writes:
>Does p.82, lines 13-15, imply that the following is not standard conforming,
>or does p.84, lines 31-34, provide an escape hatch?
"No" to the first; and, "it works but it's not escaping from
anything" to the second.
When the citation on p. 84 says "the behavior is exactly as
if the translation unit contains a file scope
declaration...with an initializer equal to 0", the
imaginary declaration-with-initializer satisfies the
requirement from the citation on p. 82, for there to be
"exactly one" external definition.
I.e., though the explicit external definition is absent, it
still properly reserves and initializes storage, which
appears to be the intent (the rationale is mute on this).
It gets away with this by hiding any definitions for `i'
with external linkage from other translation units.
I think the sentence on p. 84 could've done with a footnote.
vvvvvvvvvvvvv---could be "translation unit"
>--------------------begin code fragment
>static int i; /* tentative definition, internal linkage */
>
>int
>woof(void)
>{
> return ++i; /* usage other than in sizeof() */
>}
>--------------------end code fragment
Due to the implicit initial zero, woof() should return 1
the first time it's called, 2 the second, 3 the third, and
so on, when compiled by a conforming implementation.
--Blair
"At least, that's how I read
it. Your parsimony may vary."
Technical Details
Message-ID:
<3118@inews.intel.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!rice!uw-beaver!milton!ogicse!intelhf!ichips!inews!hopi!bhoughtoReferences:
<5450@mcrware.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!rice!uw-beaver!milton!ogicse!intelhf!ichips!inews!hopi!bhoughto From: bhoughto@hopi.intel.com (Blair P. Houghton) Newsgroups: comp.std.c Subject: Re: 3.7 constraints and 3.7.2 semantics Keywords: external/tentative definitions, internal linkage Message-ID: <3118@inews.intel.com> Date: 19 Mar 91 04:49:38 GMT References: <5450@mcrware.UUCP> Sender: news@inews.intel.com Organization: Intel Corp, Chandler, AZ Lines: 44