On Mon, 2006-07-17 at 15:57 -0400, [email protected] 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....
>
> (Unless my C mastery has severely faded of late?)
No you are right. We jump to found because we found what we are looking
for and don't need to look further in any more loops.
-- Steve
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]