From: Weiqi Gao Newsgroups: comp.os.msdos.djgpp Subject: Re: GPP Compile problem Date: Tue, 02 Nov 1999 23:51:58 -0600 Organization: CRL Network Services Lines: 50 Message-ID: <381FCD7E.9D6AA339@a.crl.com> References: NNTP-Posting-Host: a116008.stl1.as.crl.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i586) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "A. Darrow" wrote: > > [...] > As it turns out, these two files are completely different > in each compiler distribution, although they appear to be > doing the same thing. This may be apropo of nothing. The two files should be completely different, but they should do exactly the samething that's specified by the ANSI C++ standard. > [...] > The compiler error messages are as follows: > > c:\djgpp\include\istring.cpp: in method 'const class String > String::Substr(unsigned int, unsigned int)': > c:\djgpp\include\istring.cpp:191: name lookup of 'j' changed for new > ANSI 'for' scoping: > c:\djgpp\include\istring.cpp:188: using obsolte binding at 'j': This error is caused by the fact that the ANSO C++ standard changed the scoping rules for variables defined in the for() header. They go away as soon as the for loop ends now. > I have a few questions: > > 1. Are some of the header, .cpp, lib files in the DJGPP distribution (v > 2951) obsolete or out of date? I don't think so. > 2. As an aside, since Istring.cpp has a companion, Istring.h ,what is > Istring.cpp doing that Istring.h cannot or is not doing? #include-ing a .cpp file feels wrong. You should make it so that you only include .h files. > 3. What is the solution to the aforementioned problem? If you want to use j after the for loop, j need to be alive before the for loop: int j; for (j = 0; j < 10; j++) { // whatever } // can use j here. j should be 10. -- Weiqi Gao weiqigao AT a DOT crl DOT com