git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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/                      \_/     
Previous: Johannes Schindelin
Message 4 of 4 in “git wrapper: Make while loop more reader-friendly”
  1. git wrapper: Make while loop more reader-friendlyJohannes Schindelin, Jan 2, 2009
  2. Boyd Stephen Smith Jr.Jan 2, 2009
  3. Johannes SchindelinJan 2, 2009
  4. Boyd Stephen Smith Jr.Jan 2, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.