Some C++ questions
Ross Alexander
r.alexander@auckland.ac.nz
Mon Oct 27 19:33:00 GMT 1997
>
> 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
More information about the Gcc
mailing list