Trying to compile a program, in my accounts.cpp I have 2 errorspaccounts.cpp:240: error: name lookup of `a' changed for new ISO `for' scoping accounts.cpp:234: error: using obsolete binding at `a'here's the code
any help would be awsome thanks :)bool cAccount::IsOnline( int acctnum ) { if (acctnum < 0) return false; map<int, acctman_st>::iterator iter_acctman; if ((iter_acctman = acctman.find(acctnum)) != acctman.end()) { for (int a = 0; a < now; a++) { if (Client[a]->GetAccNum() == acctnum) break; } if (a == now) { SetOffline(acctnum); return false; }
I believe the diagnostic messages are telling you that the scope ofa should only be within the for loop -- that is, it is not available outside the for loop. So if you are using it outside the for loop, you should not declare it within the for loop.
bool cAccount::IsOnline( int acctnum )
{
if (acctnum < 0) return false;
map<int, acctman_st>::iterator iter_acctman;
if ((iter_acctman = acctman.find(acctnum)) != acctman.end())
{
int a;
for (a = 0; a < now; a++)
{
if (Client[a]->GetAccNum() == acctnum)
break;
}
if (a == now)
{
SetOffline(acctnum);
return false;
} Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314