[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Groff] Short Orphan Lines
From: |
Andrew Koenig |
Subject: |
RE: [Groff] Short Orphan Lines |
Date: |
Fri, 26 Mar 2004 15:04:51 -0500 |
> > g++2 -I. -I. -I/Users/rgouldin/groff/src/include
> > -I/Users/rgouldin/groff/src/include -DHAVE_CONFIG_H -DWIDOW_CONTROL -g
> > -O2 -c env.cpp
> > env.cpp: In method `void environment::mark_last_line()':
> > env.cpp:176: name lookup of `p' changed for new ANSI `for' scoping
> > env.cpp:174: using obsolete binding at `p'
> > make[2]: *** [env.o] Error 1
> > make[1]: *** [src/roff/troff] Error 2
> > make: *** [all] Error 2
> >
> > Is there a simple fix for this (an additional flag etc.)?
Without seeing the code, I am guessing that something is happening like
this:
for (int i = 0; != n; ++i)
foo(i);
for (i = 0; i != n; ++i)
bar(i)
This code used to be valid C++, but is no longer, because "i" goes out of
scope at the end of the first "for" statement. Moreover, if you change it
to be correct now:
for (int i = 0; != n; ++i)
foo(i);
for (int i = 0; i != n; ++i)
bar(i)
it may fail to compile on older compilers.
The safest way to deal with it is to declare the variable in each loop *and*
change its name:
for (int i = 0; != n; ++i)
foo(i);
for (int j = 0; j != n; ++j)
bar(j)
- RE: [Groff] Short Orphan Lines, (continued)