Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 May 1997 20:01:29 +1000
From:      David Nugent <davidn@labs.usn.blaze.net.au>
To:        freebsd-hackers@freebsd.org
Subject:   Re: g++ shared library segfaults 
Message-ID:  <199705121001.UAA16897@labs.usn.blaze.net.au>
In-Reply-To: Your message of "Sat, 10 May 1997 08:31:42 %2B0200." <19970510083142.OD64404@uriah.heep.sax.de> 

next in thread | previous in thread | raw e-mail | index | archive | help
J"org writes:
> As Justin T. Gibbs wrote:
> 
> >    * 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.
> 
> Du-oh.  While i always considered it poor style to declare a variable
> inside a for statement, when it was intended to use it later on, i
> think that's a fairly drastic change in the semantics.

Indeed it is and was. It broke many things at the time. I still
have to fix the occasional program by moving the declaration outside
of the for() statement.

This was part of a wider set of changes relating to scope and the
semantics of declarations, but this is the only area which actually
caused working code to break. Doing it was necessary for reasons of
consistency since they wanted to support if ((int x = blah) ... and
so on, otherwise it would have become a language wart (or ANOTHER
language wart, where C++ is concerned :-)). The change did actually
simplify the rules from the point of view of parsing c++ code.


Regards,
David


David Nugent - Unique Computing Pty Ltd - Melbourne, Australia
Voice +61-3-9791-9547  Data/BBS +61-3-9792-3507  3:632/348@fidonet
davidn@freebsd.org davidn@blaze.net.au http://www.blaze.net.au/~davidn/



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