From owner-freebsd-hackers Fri May 9 18:35:08 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id SAA10460 for hackers-outgoing; Fri, 9 May 1997 18:35:08 -0700 (PDT) Received: from filoli.filoli.com (filoli.filoli.com [204.162.0.10]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id SAA10455 for ; Fri, 9 May 1997 18:35:05 -0700 (PDT) Received: from sunspot.filoli.com ([204.162.1.17]) by filoli.filoli.com (8.8.5/8.8.5) with ESMTP id SAA25852; Fri, 9 May 1997 18:32:48 -0700 (PDT) Received: from diamond.filoli.com (diamond [204.162.1.183]) by sunspot.filoli.com (8.8.5/8.8.5) with SMTP id SAA08173; Fri, 9 May 1997 18:32:47 -0700 (PDT) Message-Id: <199705100132.SAA08173@sunspot.filoli.com> Received: by diamond.filoli.com (NX5.67e/NX3.0X) id AA12748; Fri, 9 May 97 18:32:46 -0700 Content-Type: text/plain Mime-Version: 1.0 (NeXT Mail 3.3 v118.2) In-Reply-To: <199705100046.RAA01368@phaeton.artisoft.com> X-Nextstep-Mailer: Mail 3.3 (Enhance 1.3) Received: by NeXT.Mailer (1.118.2) From: Kevet Duncombe Date: Fri, 9 May 97 18:32:44 -0700 To: Terry Lambert Subject: Re: g++ shared library segfaults Cc: freebsd-hackers@FreeBSD.ORG Reply-To: kevet@filoli.com References: <199705100046.RAA01368@phaeton.artisoft.com> Organization: Filoli Information Systems Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk You wrote: > > > for (long i = 0; i < count; ++i) { > > > ViewerColorInfo& info = _color_info->item_ref(i); > > > if (strcmp(info._name, name) == 0) { > > > break; > > > } > > > } > > > > > > later on it checks the value of i. I change the scope of i and doc just > > > fired right up. Will "fix" similar referencs in doc. > > > > > > Uh, that's not an illegal reference. The scope of i extends to the > > > end of the containing block, not the end of the "for" statement. > > For what it's worth, MSCVC++ and Borland C++ and Oregon C++ all have > this same "compiler bug". Are you *sure* about the determination of > scope? Though it's been that way in the past, according to the Nov. 1996 working paper at: http://www.csci.csusb.edu/dick/c++std/cd2/stmt.html a change is coming (and it looks like the PC vendors are tracking it). "3 If the for-init-statement is a declaration, the scope of the name(s) declared extends to the end of the for-statement. [Example: int i = 42; int a[10]; for (int i = 0; i < 10; i++) a[i] = i; int j = i; // j = 42 --end example]" --kevet