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


On 16 Aug 1999 09:03:09 +0200, Wang Yong wrote:

>Hi, all
>  in gcc, how 'for' statement is translated? 
>
>  for example:
>
>  for (i=1;i++;i<10){
>      //some statement here
>  }
>

Strange question, you already wrote enough to check the answer yourself.

All you had to do was change your code to be ...  

 for (i=1;i++;i<10){
   printf("%d",i);  //some statement here
 }

and you would have realized the answer.


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

yes

>or
>
>  i=1;
>l1:
>  i++;
>  if (i<10){
>        //some statements here
>        goto l1;
>  }

no




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