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, 18:28 UTC
Message-ID
<200901021228.07599.bss@iguanasuicide.net>
In-Reply-To
<alpine.DEB.1.00.0901021240270.27818@racer>
On Friday 2009 January 02 12:07:52 you wrote:
Show 6 quoted lines
> It is not a good practice to prefer performance over readability in
> something as performance uncritical as finding the trailing slash
> of argv[0].
>
> So avoid head-scratching by making the loop user-readable, and not
> hyper-performance-optimized.
Show 5 quoted lines
> -	do
> -		--slash;
> -	while (cmd <= slash && !is_dir_sep(*slash));
> +	while (cmd <= slash && !is_dir_sep(*slash))
> +		slash--;

What confused people? The predecrement or the do/while? Should people that don't understand one of those be hacking on git?

That said, I'm not opposed to the patch. It is easier on the eyes, though I prefer the one-liner: for (; cmd <= slash && !is_dir_sep(*slash); --slash);

-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 2 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.