From owner-freebsd-hackers Fri May 9 19:23:02 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id TAA11978 for hackers-outgoing; Fri, 9 May 1997 19:23:02 -0700 (PDT) Received: from pluto.plutotech.com (root@mail.plutotech.com [206.168.67.137]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id TAA11973 for ; Fri, 9 May 1997 19:23:00 -0700 (PDT) Received: from narnia.plutotech.com (narnia.plutotech.com [206.168.67.130]) by pluto.plutotech.com (8.8.5/8.8.3) with ESMTP id UAA05625; Fri, 9 May 1997 20:22:03 -0600 (MDT) Message-Id: <199705100222.UAA05625@pluto.plutotech.com> To: Terry Lambert cc: hasty@rah.star-gate.com (Amancio Hasty), moore@WOLFENET.com, freebsd-hackers@FreeBSD.ORG Subject: Re: g++ shared library segfaults In-reply-to: Your message of "Fri, 09 May 1997 17:46:24 PDT." <199705100046.RAA01368@phaeton.artisoft.com> Date: Fri, 09 May 1997 21:20:17 -0600 From: "Justin T. Gibbs" Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> > 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? There was a change in the C++ spec fairly recently and g++ as of 2.7.X now follows the spec. From the NEWs entry in the g++ info document: * As described above, the scope of variables declared in the initialization part of a for statement has been changed; such variables are now visible only in the loop body. Use `-fno-for-scope' to get the old behavior. You'll need this flag to build groff version 1.09, Ptolemy, and many other free software packages. > Terry Lambert > terry@lambert.org >--- >Any opinions in this posting are my own and not those of my present >or previous employers. > -- Justin T. Gibbs =========================================== FreeBSD: Turning PCs into workstations ===========================================