C++, strange behavior reusing variable name
- by aaa
hello.
I have following snippet:
{
double scale = 3; // not used?
{
double scale = 4*scale; // what is RHS scale?
for (...) {
// scale is 0 here, using g++
}
}
}
moreover, g++ reports first scale is not used. how is second scale initialize?
What should be correct behavior?
thanks