This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: about the 'for' statement
- To: "egcs at egcs dot cygnus dot com" <egcs at egcs dot cygnus dot com>
- Subject: Re: about the 'for' statement
- From: "R. Kelley Cook" <KCook at IBM dot net>
- Date: Mon, 16 Aug 1999 13:53:02 -0400 (EDT)
- Reply-To: "R. Kelley Cook" <KCook at IBM dot net>
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