[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1H2GZt-0008HG-00@gondolin.me.apana.org.au>
Date: Thu, 04 Jan 2007 11:35:29 +1100
From: Herbert Xu <herbert@...dor.apana.org.au>
To: gerrit@....abdn.ac.uk (Gerrit Renker)
Cc: davem@...emloft.net, netdev@...r.kernel.org, arnaldo.melo@...il.com
Subject: Re: removing gotos considered harmful...
Gerrit Renker <gerrit@....abdn.ac.uk> wrote:
>
> size = 0;
> sk_for_each(sk2, node, list)
> if (++size >= best_size_so_far)
> goto next;
> best_size_so_far = size;
> best = result;
> next:;
>
>
> | and this got converted into:
> |
> | sk_for_each(sk2, node, head)
> | if (++size < best_size_so_far) {
> | best_size_so_far = size;
> | best = result;
> | }
> |
> | Which does something very very different from the original.
> ===> Sorry, I fail to see where the two differ. They have the same postcondition
> upon loop exit; sk2, node, size, and head are not referenced anywhere in the
> code that follows.
They're different because the former only updates best_size_so_far
after termination while the latter does it from the start. It's
like moving the goal-posts while someone's trying to shoot :)
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists