This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: about the 'for' statement


"R. Kelley Cook" <KCook@IBM.net> writes:

> >  for (i=1;i++;i<10){
> >      //some statement here
> >  }

> >  If this for statement will be translated to something like this :
> >
> >  i=1;
> >l1:
> >  if (i<10){
> >        //some statements here
> >        i++;
> >        goto l1;
> >  }
> >
> 
> yes

Wrong.  Try:

  i=1;
  l1:
  if (i++){
     //some statements here
     i<10;  // no-op.
     goto l1;
  }

I.e. the i++ and i<10 are probably switched ...
-- 
	--Per Bothner
bothner@pacbell.net  per@bothner.com   http://home.pacbell.net/bothner/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]