Date: Fri, 9 May 97 18:32:44 -0700 From: Kevet Duncombe <kevet@filoli.com> To: Terry Lambert <terry@lambert.org> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: g++ shared library segfaults Message-ID: <199705100132.SAA08173@sunspot.filoli.com> In-Reply-To: <199705100046.RAA01368@phaeton.artisoft.com> References: <199705100046.RAA01368@phaeton.artisoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705100132.SAA08173>