Article View: comp.std.c
Article #2392Re: Structure tags
From: Michael Kahl
Date: Sat, 09 Feb 1991 16:40
Date: Sat, 09 Feb 1991 16:40
28 lines
1827 bytes
1827 bytes
In article <15135@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes:
>In article <595@taumet.com> steve@taumet.com (Stephen Clamage) writes:
>-t-itoh@utsm.nm.fujitsu.co.jp (Tsutomu Itoh) writes:
>->1a.
>->struct foo {int i;};
>->struct foo;
>->struct foo bar;
>-Both of these are ok. In 1a there is no incomplete declaration.
>
>Sure there is; the second "struct foo" type is not completed.
>If any essential use is made of "bar", there is an error.
>The second declaration (tag only) in effect cancels the previous
>"struct foo" type information for the following code. This is a
>special wart spelled out in 3.5.2.3.
Are you certain? 3.5.2.3 says a tag-only struct declaration "specifies
a new type distinct from any type with the same tag IN AN ENCLOSING
SCOPE (if any)." (My emphasis.) From the Rationale it is clear that
the purpose of this feature is to allow a forward reference in an
*inner* block to a struct which already exists in an *outer* block
but which will be redeclared in the inner block. I don't see anything
in the Standard to suggest that a tag-only declaration "cancels" a
previous declaration in the *same* scope.
--
Michael Kahl, Symantec Corporation
mkahl@world.std.com -or- 75236.3146@compuserve.com
Disclaimer: Keep this quiet; what my employer doesn't know won't get me fired.
Technical Details
Message-ID:
<1991Feb9.164052.9691@world.std.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!sun-barr!cs.utexas.edu!uunet!world!mkahlReferences:
<4736@utsm.nm.fujitsu.co.jp> <595@taumet.com> <15135@smoke.brl.mil>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!sun-barr!cs.utexas.edu!uunet!world!mkahl From: mkahl@world.std.com (Michael Kahl) Newsgroups: comp.std.c Subject: Re: Structure tags Message-ID: <1991Feb9.164052.9691@world.std.com> Date: 9 Feb 91 16:40:52 GMT References: <4736@utsm.nm.fujitsu.co.jp> <595@taumet.com> <15135@smoke.brl.mil> Organization: The World @ Software Tool & Die Lines: 28