linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Joe Perches <joe@perches.com>
Cc: linux-i2c@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [PATCH] i2c: uniphier[-f]: fix bool logic calculation
Date: Thu, 22 Dec 2016 00:39:21 +0900	[thread overview]
Message-ID: <CAK7LNAS7DaG-Ath1-qzA3C6WLNV=YiSCjgDnsOH4-eS0yt04Hg@mail.gmail.com> (raw)
In-Reply-To: <1482256538.1984.23.camel@perches.com>

Hi Joe,


2016-12-21 2:55 GMT+09:00 Joe Perches <joe@perches.com>:
> On Wed, 2016-12-21 at 01:20 +0900, Masahiro Yamada wrote:
>> Hi.
>>
>> I have not got any comment, but does this seem
>> a right thing to do?
>
>> This code is working, but it should not depend on how "bool" is
>> typedef'ed, or the bit position of I2C_M_RD.
>
> <shrug>
>
> I think bool can be guaranteed to be _Bool.
>
> So a change not necessary as the original code
> has a c90 guarantee of the same result.
>
> 6.3.1.2 Boolean type
> 1
> When any scalar value is converted to _Bool, the result is 0 if the value compares equal
> to 0; otherwise, the result is 1.
>

Thanks for your comments!

_Bool works very nicely.

I have seen some (not very nice) projects
that define like "typedef char bool;"

So, I was wondering if I should write code
that works regardless how bool is defined.
Just my two cents.

-- 
Best Regards
Masahiro Yamada

      reply	other threads:[~2016-12-21 15:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19  4:38 Masahiro Yamada
2016-12-20 16:20 ` Masahiro Yamada
2016-12-20 17:55   ` Joe Perches
2016-12-21 15:39     ` Masahiro Yamada [this message]

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='CAK7LNAS7DaG-Ath1-qzA3C6WLNV=YiSCjgDnsOH4-eS0yt04Hg@mail.gmail.com' \
    --to=yamada.masahiro@socionext.com \
    --cc=joe@perches.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    --subject='Re: [PATCH] i2c: uniphier[-f]: fix bool logic calculation' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).