Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 May 1997 21:20:17 -0600
From:      "Justin T. Gibbs" <gibbs@plutotech.com>
To:        Terry Lambert <terry@lambert.org>
Cc:        hasty@rah.star-gate.com (Amancio Hasty), moore@WOLFENET.com, freebsd-hackers@FreeBSD.ORG
Subject:   Re: g++ shared library segfaults 
Message-ID:  <199705100222.UAA05625@pluto.plutotech.com>
In-Reply-To: Your message of "Fri, 09 May 1997 17:46:24 PDT." <199705100046.RAA01368@phaeton.artisoft.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
>> >     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
===========================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705100222.UAA05625>