Source-Changes-D archive

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

Re: The --> "operator" (was: Re: CVS commit: src/sys/uvm)



> Date: Thu, 09 Jul 2026 06:59:41 +0700
> From: Robert Elz <kre%munnari.OZ.AU@localhost>
> 
>     Date:        Wed, 8 Jul 2026 15:31:01 +0000
>     From:        Taylor R Campbell <riastradh%NetBSD.org@localhost>
>     Message-ID:  <20260708153102.C64DD84DA8%mail.netbsd.org@localhost>
> 
>   | I can tell you in a second _one_ of them is definitely correct, and
>   | for _every other one_ it'll take me at least a few seconds if not a
>   | few minutes to think about.
> 
> Really?

Really!

>   | 	for (i = N; i --> 0;) { ... i ... }
> 
> That one, which is the one you (claim to) prefer, and
> 
>   | 	for (i = N; i-- > 0;} { ... i ... }
> 
> this one, which is in KNF (ignoring the statement part), differ by
> exactly the positioning of one (unnecessary) space.
> 
> 	for (i=N;i-->0;} { ... i ...}
> 
> is just the same, compressed a bit (I am not suggesting that be used).
> 
> You're really unable to see that these 3 all do the exact same thing in more
> than about a millisecond?

Absolutely yes, because with

	i-- > 0

I have to stop and think whether pre-increment or post-increment is
correct here.  In contrast

	i --> 0

is highly memorable.


Home | Main Index | Thread Index | Old Index