[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: kdelibs/khtml
From: Lubos Lunak <l.lunak () suse ! cz>
Date: 2005-04-08 12:56:18
Message-ID: 200504081456.18363.l.lunak () suse ! cz
[Download RAW message or body]
On Friday 08 of April 2005 14:21, Tobias Anton wrote:
> Am Donnerstag, 7. April 2005 19:24 schrieb Lubos Lunak:
> > > What about a
> > > "do ... while (!necessary);"
> > > or even a
> > > "do { ... continue; } while (false);"
> > > loop?
> >
> > Just curious, what benefits should this exactly bring, other than
> > affecting cvs annotate for 100+ lines and making Dijkstra happy?
>
> Readability. Every single backward goto can be expressed by a loop. A loop
> is easier to read because you don't have to look up any label's position to
> figure out whether a "continue" or "break" results in a backward or forward
> jump.
>
> Comparing your backward goto to a loop, I don't see any advantage of the
> backward goto. The main disadvantage of the backward goto: The exit
> condition is not clear, whereas a loop would make it clear.
Maybe if the code was written with a loop in mind, but the JPEG loader is
written as linear code that just needs to go back in one place. I even tried
to make it a loop first, but after getting it wrong two times I simply gave
up (I did the mistake of trying to use a flag to bail out instead of the
other way around, and that was pretty non-trivial).
> Finally,
> introducing a loop makes no difference in the number of lines at all:
>
> -again:
> + do {
>
> - // don't return until necessary!
> - goto again;
>
> + } while (state == decompressStarted);
>
> As you can see, this patch replaces 2 lines of code, not 100+, so your
> argument is wrong.
And reindents 100+ lines. *shrug* but if you care so much about it, why don't
you simply commit that thing above? When nobody complained when I posted the
patch for review I thought that simply nobody cared.
> If you care about code indentation, things are
> different, admitted, but I care for cvs annotate less than for the code
> itself. A flaw of our SCM should not affect the developed software,
> otherwise it's a bad SCM.
>
> Cheers
> -- Tobias
--
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o. e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27 tel: +420 2 9654 2373
190 00 Praha 9 fax: +420 2 9654 2374
Czech Republic http://www.suse.cz/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic