Scope of incomplete types
Larry Jones
scjones at thor.UUCP
Tue Sep 11 00:05:33 AEST 1990
In article <1990Sep9.194037.346 at charis.UUCP>, wmm at charis.UUCP (William M. Miller) writes:
>
> struct X* p1;
> void f() {
> struct X* p2;
> p2 = p1; /* A */
> }
> struct X { int i; }; /* B */
>
> INTERPRETATION 1: This is a legal compilation unit. p1 and p2 have the same
> type, so assignment A is allowed. Implication: the wording in the Standard
> requiring a completing declaration to be in the same block does not apply to
> the declaration inside f() because the type was introduced in the outer
> scope. Implication: the wording in the Rationale mentioning a definition is
> excessively restrictive.
Bingo!
The wording in section 3.5.2.3 could perhaps be clearer, but that
is certainly the intent of the committee. Remember, the Rationale
is not a part of the standard -- it uses much less formal and
precise language to try to explain >why< the standard says what it
says, not to explain >what< it says.
----
Larry Jones UUCP: uunet!sdrc!thor!scjones
SDRC scjones at thor.UUCP
2000 Eastman Dr. BIX: ltl
Milford, OH 45150-2789 AT&T: (513) 576-2070
I think my cerebellum just fused. -- Calvin
More information about the Comp.std.c
mailing list