Path: utzoo!attcan!uunet!jarthur!uci-ics!rfg From: rfg@ics.uci.edu (Ron Guilmette) Newsgroups: comp.lang.c++ Subject: Re: g++ core dump from improper use of extern "C" Message-ID: <25AFE9B7.14113@paris.ics.uci.edu> Date: 14 Jan 90 02:53:42 GMT References: <1581@aber-cs.UUCP> <18157@umn-cs.CS.UMN.EDU> Reply-To: rfg@ics.uci.edu (Ron Guilmette) Organization: UC Irvine Department of ICS Lines: 27 In article <18157@umn-cs.CS.UMN.EDU> mike@umn-cs.cs.umn.edu (Mike Haertel) writes: > >Just to be pedantic, this is not strictly true. It is OK to >declare a pointer to an incomplete type, so this works *here*. >But consider the following counterexample: > >/*1*/ struct b { int x; }; >/*2*/ >/*3*/ void foo() { >/*4*/ struct b; >/*5*/ struct a { struct b *b; } *a; >/*6*/ struct b { struct a *a; } *b; >/*7*/ >/*8*/ b = a->b; >/*9*/ } > >In this case, line 4 is necessary to make "struct b" an incomplete type. >Otherwise, the "struct b *b" in line 5 would refer to the "struct b" >declared on line 1... Buzzzzzzzt! Sorry, no! But thanks for playing our game. Just for being such a good sport you win a free copy of our home game, complete with the new 2.0 Reference Manual. :-) :-) :-) // rfg