Re: [CLEANUP PATCH RESEND] git wrapper: Make while loop more reader-friendly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, 2 Jan 2009, Boyd Stephen Smith Jr. wrote:

> On Friday 2009 January 02 12:07:52 you wrote:
> > 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.
> 
> > -	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);

As I mentioned in the commit message: readability is something to be 
cherished and worshipped.

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.

Ciao,
Dscho

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux