From: Michael Buesch <mb@bu3sch.de>
To: Valdis.Kletnieks@vt.edu
Cc: linux-kernel@vger.kernel.org, keir@xensource.com,
Tony Lindgren <tony@atomide.com>,
zach@vmware.com, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Andreas Mohr <andi@rhlx01.fht-esslingen.de>
Subject: Re: kernel/timer.c: next_timer_interrupt() strange/buggy(?) code (2.6.18-rc1-mm2)
Date: Tue, 18 Jul 2006 16:29:27 +0200 [thread overview]
Message-ID: <200607181629.27933.mb@bu3sch.de> (raw)
In-Reply-To: <200607171957.k6HJvPHT022236@turing-police.cc.vt.edu>
On Monday 17 July 2006 21:57, Valdis.Kletnieks@vt.edu wrote:
> On Mon, 17 Jul 2006 20:53:30 +0200, Andreas Mohr said:
> > Hi all,
> >
>
> > for (i = 0; i < 4; i++) {
> > j = INDEX(i);
> > do {
>
> > if (j < (INDEX(i)) && i < 3)
> > list = varray[i + 1]->vec + (INDEX(i + 1));
> > goto found;
> > } while (j != (INDEX(i)));
> > }
> > found:
>
> > Excuse me, but why do we have a while loop here if the last instruction in
> > the while loop is a straight "goto found"?
>
> Consider if we take the 'goto found' when i==1. We leave not only the do/while
> but also the for loop. A 'continue' instead would leave the do/while and then
> drive the i==2 and subsequent 'for' iterations....
No, it would not. A 'continue' instead of the 'goto found' would
compile to nothing.
Try the following example with and without the 'continue'.
#include <stdio.h>
int main(void)
{
int i, j;
for (i = 0; i < 2; i++) {
j = 0;
do {
printf("i==%d, j==%d\n", i, j);
j++;
/* goto found; */
continue;
} while (j < 2);
}
}
Continue is equal to:
LOOP {
/* foo */
goto continue; /* == continue */
/* foo */
continue:
} LOOP
--
Greetings Michael.
next prev parent reply other threads:[~2006-07-18 14:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-17 18:53 Andreas Mohr
2006-07-17 19:01 ` Michael Buesch
2006-07-17 19:57 ` Valdis.Kletnieks
2006-07-18 1:50 ` Steven Rostedt
2006-07-18 14:29 ` Michael Buesch [this message]
2006-07-18 14:50 ` Valdis.Kletnieks
2006-07-18 15:04 ` Michael Buesch
2006-07-17 20:22 ` Andreas Schwab
2006-07-18 1:47 ` [PATCH] fix bad macro param in timer.c (was: kernel/timer.c: next_timer_interrupt() strange/buggy(?) code (2.6.18-rc1-mm2)) Steven Rostedt
2006-07-18 1:59 ` [PATCH] fix bad macro param in timer.c Steven Rostedt
2006-07-18 15:14 ` kernel/timer.c: next_timer_interrupt() strange/buggy(?) code (2.6.18-rc1-mm2) Prakash Punnoor
2006-07-18 16:02 ` offtopic boot parameter notsc [Was: Re: kernel/timer.c: next_timer_interrupt() strange/buggy(?) code (2.6.18-rc1-mm2)] Sergio Monteiro Basto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200607181629.27933.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=Valdis.Kletnieks@vt.edu \
--cc=andi@rhlx01.fht-esslingen.de \
--cc=keir@xensource.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=tony@atomide.com \
--cc=zach@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®