lkml.org 
[lkml]   [2021]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [greybus-dev] [PATCH] staging: greybus: fixed the coding style, labels should not be indented.
From
Date
On 6/4/21 3:13 AM, David Laight wrote:
> Yes, and it isn't at all clear what it actually means.
> If the value of a bool memory location isn't 0 or 1
> what does 'bool_a & bool_b' mean.

I think this discussion is done, but I wanted to point out
that the above expression is incorrect. It might be valid,
but it would be bad code. A Boolean, when properly used,
should only be compared with true and false (or the result
of another Boolean expression). Therefore "&" is not the
right operator, "&&" is. The reason is similar to why you
would never use ~bool_a, you use !bool_a to invert its value.

-Alex

\
 
 \ /
  Last update: 2021-06-04 14:34    [W:0.074 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site