This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

warning that warns about iso compliant code



Hi all, this is more of a complaint/feature request


for code such as:

int main()
{
int nToProcess=0;
for (int i=0; i<nToProcess; ++i)
{
int nComp=0;
for (int i=0; i<nComp; ++i)
{
int j=i;
}
int q=i;
}
return 0;
}


I have the following warnings:


testNetsted.cpp: In function ‘int main()’:
testNetsted.cpp:11: warning: name lookup of ‘i’ changed
testNetsted.cpp:4: warning: matches this ‘i’ under ISO standard rules
testNetsted.cpp:7: warning: matches this ‘i’ under old rules

To me it seems the compiler should not warn about code that follows the ISO standard rules... It would be nice if the compiler warned about the case that didn't follow the standard. Or am I just being silly and I should use different index variable name for all of my nested loops, even when the don't depend on each other...

Thanks Burlen



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]