Re: [CLEANUP PATCH RESEND] git wrapper: Make while loop more reader-friendly
- From
Boyd Stephen Smith Jr. <bss@iguanasuicide.net>
- Date
- Jan 2, 2009, 20:04 UTC
- Message-ID
- <200901021404.05811.bss@iguanasuicide.net>
- In-Reply-To
- <alpine.DEB.1.00.0901021947170.30769@pacific.mpi-cbg.de>
On Friday 2009 January 02 12:49:53 Johannes Schindelin wrote:
Show 11 quoted lines
> > > - do > > > - --slash; > > > - while (cmd <= slash && !is_dir_sep(*slash)); > > > + while (cmd <= slash && !is_dir_sep(*slash)) > > > + slash--; > > > > I prefer the one-liner: > > for (; cmd <= slash && !is_dir_sep(*slash); --slash); > > As I mentioned in the commit message: readability is something to be > cherished and worshipped.
It's also subjective. I think my one-line is more readable than your two lines which is only slightly more readable than the original 3 lines. Or is there some objective readability metric that of which I'm just not aware?
I also think that the lack of braces around your body on a separate line makes it harder to read and easier to break, but I understand that is the git coding style.
> For your pleasure, I will not go into details about the motions my bowels > went through when I looked at those three lines. Or your single line, for > that matter.
Please do, although privately if you like. I really don't see the problem the patch is trying to fix.
-- Boyd Stephen Smith Jr. ,= ,-_-. =. bss@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/ \_/