From: Karl-Johan Karlsson Newsgroups: comp.os.msdos.djgpp Subject: Linked lists Date: Sun, 22 Mar 1998 09:59:39 +0100 Organization: A customer of Tele2 Lines: 45 Message-ID: <3514D2FB.3885@swipnet.se> NNTP-Posting-Host: mn8.swip.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cache-Post-Path: mn8!s-52511 AT dialup86-9-12 DOT swipnet DOT se To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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; } } } }