From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: compile warning Date: Sat, 10 May 1997 10:32:03 -0700 Organization: Alcyone Systems Lines: 27 Message-ID: <3374B113.BA2DD4A@alcyone.com> References: <3373AC95 DOT 2D64 AT osu DOT edu> <5l10p2$541u AT news DOT doit DOT wisc DOT edu> NNTP-Posting-Host: newton.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk John Fremlin wrote: > This is ugly, C already has a nice keyword for doing this: > > for( int wait = 0; wait < 5000; wait++ ) > {} > > Second, the compiler might optimize this out to: > > int wait = 5000; Shouldn't even do that -- in the new C++ spec (which gcc now supports), variables defined inside of a for loop are local to that loop. So for (int wait = 0; wait < 5000; wait++) ; wait = 0; should give you an error. -- Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com Alcyone Systems / web / http://www.alcyone.com/max/ San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W \ "The future / is right there." / Bill Moyers