From: Richard Knutsson <ricknu-0@student.ltu.se>
To: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Cc: Paul Jimenez <pj@place.org>,
rgooch@atnf.csiro.au, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtrr use type bool
Date: Wed, 31 Oct 2007 21:25:16 +0100 [thread overview]
Message-ID: <4728E4AC.7010009@student.ltu.se> (raw)
In-Reply-To: <20071031162016.GD27646@csclub.uwaterloo.ca>
Lennart Sorensen wrote:
> On Wed, Oct 31, 2007 at 04:27:31PM +0100, Richard Knutsson wrote:
>
>> Paul Jimenez wrote:
>>
> ....
>
>>> - usage_table[i] = usage_table[replace] + !!increment;
>>> + usage_table[i] = usage_table[replace] + increment;
>>>
>>>
>> This seems a bit strange, using a boolean as an integer (yes I know, it
>> works but semantically...). What about:
>>
>> + usage_table[i] = usage_table[replace];
>> + usage_table[i] += increment ? 1 : 0;
>>
>
> What is wrong with:
> usage_table[i] = usage_table[replace];
> if (increment)
> usage_table[i]++;
>
> I hate code with the '?' operator in general. It's a conditional either
> way, and at least this way you wouldn't even have to do a store in one
> of the two cases 9although if the compiler can't figure out that is the
> case already, then it really sucks).
>
I kind of like them :)
But you are right, since the 'else' doesn't do anything, an if() is more
clear.
> Pauls code at least didn't involve a conditional at all, but on the
> other hand is less clear to read.
>
Mm, I know. But on the upside, many places had/have some sort of a = b ?
TRUE : FALSE, which are getting cleaned out.
Richard Knutsson
next prev parent reply other threads:[~2007-10-31 20:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-31 3:57 [PATCH] mtrr use type bool Paul Jimenez
2007-10-31 15:27 ` Richard Knutsson
2007-10-31 16:20 ` Lennart Sorensen
2007-10-31 20:25 ` Richard Knutsson [this message]
2007-10-31 16:27 ` Paul Jimenez
2007-10-31 20:49 ` Richard Knutsson
2007-11-02 20:14 ` [PATCH] mtrr use type bool [RESEND] Paul Jimenez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4728E4AC.7010009@student.ltu.se \
--to=ricknu-0@student.ltu.se \
--cc=linux-kernel@vger.kernel.org \
--cc=lsorense@csclub.uwaterloo.ca \
--cc=pj@place.org \
--cc=rgooch@atnf.csiro.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.