This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [ast-optimizer-branch] simplifying C++
- From: Diego Novillo <dnovillo at redhat dot com>
- To: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Cc: Jason Merrill <jason at redhat dot com>,Daniel Berlin <dberlin at dberlin dot org>,"gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: 17 Jun 2002 12:40:14 -0400
- Subject: Re: [ast-optimizer-branch] simplifying C++
- References: <Pine.LNX.4.33.0206171728540.17444-100000@kern.srcf.societies.cam.ac.uk>
On Mon, 2002-06-17 at 12:31, Joseph S. Myers wrote:
> On 17 Jun 2002, Diego Novillo wrote:
>
> > On Mon, 2002-06-17 at 12:07, Jason Merrill wrote:
> > > I've been thinking about simplifying C++, and the complex scoping that C++
> > > loops have. In a for loop, a decl in the for-init-stmt is in scope for the
> > > duration of the loop; a decl in the condition is in scope within an
> > > iteration, goes out of scope, and back in. The first can be dealt with
> > > simply by wrapping the loop in a scope.
> > >
> > Are these the same rules as for C99? When I ran into this one last
> > week, the front end was already enclosing the loop in a scope, so the
> > simplifier didn't have to do much more than recognizing DECL_STMTs
> > inside FOR_INIT_STMT.
>
> C99 doesn't allow decls in the condition (so just does need to enclose the
> loop in a scope - it's because these extra scopes are only applied in C99
> mode that this feature isn't accepted as an extension in gnu89 mode).
>
I know. I was referring to decls in FOR_INIT_STMT. But in re-reading
my message I see that I didn't make that clear. Sorry.
Diego.