about the 'for' statement

Per Bothner per@bothner.com
Tue Aug 31 23:20:00 GMT 1999


"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/



More information about the Gcc mailing list