David Riley <[email protected]> wrote:

> On Sep 25, 2020, at 3:13 PM, Todd C. Miller <[email protected]> wrote:
> > 
> > On Fri, 25 Sep 2020 13:58:01 -0500, Scott Cheloha wrote:
> > 
> >> `found' serves as a boolean here.  I'd prefer to simple and set it to
> >> 1 instead of incrementing it when we find what we're looking for.
> > 
> > Makes sense to me, the use of var++ instead of var=1 is old-school
> > style ;-)
> 
> There are still some architectures where an increment vs. an immediate load 
> is a shorter instruction, but I strongly suspect the performance difference 
> (where there even is one) is not worth the unclarity here.

Which architecture is faster to load+increment+store, than store a constant?
I'd like to know.

But let's look deeper.  How about we fix OpenBSD to support 2GB or 4GB
of processes.  What happens next?

Alternatively on some architectures it is faster to increment a char than
an int, how about we change var to 'char var = 0'?  Still feeling good about
the change?

Premature optimization can be hazardous.  The ++ code as written carries
meanings and intents, which are incorrect.



Reply via email to