Thread (4 messages) 4 messages, 2 authors, 2016-12-21

[PATCH] i2c: uniphier[-f]: fix bool logic calculation

From: Masahiro Yamada <hidden>
Date: 2016-12-21 15:39:36
Also in: linux-i2c, lkml

Hi Joe,


2016-12-21 2:55 GMT+09:00 Joe Perches [off-list ref]:
On Wed, 2016-12-21 at 01:20 +0900, Masahiro Yamada wrote:
quoted
Hi.

I have not got any comment, but does this seem
a right thing to do?
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help