Mail Archives: djgpp/1998/03/22/22:02:15
I have trouble with linked lists in DJGPP. This is a piece of code
I found "C++ for dummies" and it worked in Turbo C++, but in DJGPP
I get:
1. warning: name lookup of `pC' changed for new ANSI `for' scoping
2. warning: using obsolete binding at `pC'
What's wrong?
(member variables)
static Card *pFirst;
Card *pNext;
(in constructor)
if(pFirst == 0)
{
pFirst = this;
}
else
}
2. for(Card *pC = pFirst; pC->pNext; pC = pC->pNext)
{
}
1. pC->pNext = this;
}
}
In this destuctor, however, no error is generated. Why?
Card::~Card()
{
if(pFirst == this)
{
pFirst = pNext;
}
else
{
for(Card *pC = pFirst; pC; pC = pC->pNext)
{
if(pC->pNext == this)
{
pC->pNext = pNext;
break;
}
}
}
}
- Raw text -