This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Some C++ questions
- To: r dot alexander at auckland dot ac dot nz (Ross Alexander)
- Subject: Re: Some C++ questions
- From: Ross Alexander <r dot alexander at auckland dot ac dot nz>
- Date: Tue, 28 Oct 1997 16:32:02 +1300 (NDT)
>
> Here are a couple of C++ scoping questions I have.
>
> 1)
>
> int main()
> {
> if (int i = 10)
> i++; // should be okay
> i++; // shold be out of scope
> }
EGCS does not complain about this, even though it is wrong.
However, it does complain about
int main()
{
if (int i = 10)
i++;
++i;
}
Something funny happens about scoping around the if. While
this probably isn't a bug (since it doesn't generate incorrect
code since the i++ doesn't do anything) it certainly is a quirk.
--
Ross Alexander r.alexander@auckland.ac.nz
Department of Statistics
University of Auckland
New Zealand