From: Alex Elder <elder@linaro.org>
To: David Laight <David.Laight@ACULAB.COM>,
'Manikishan Ghantasala' <manikishanghantasala@gmail.com>,
Alex Elder <elder@ieee.org>
Cc: Alex Elder <elder@kernel.org>,
"greybus-dev@lists.linaro.org" <greybus-dev@lists.linaro.org>,
"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
Johan Hovold <johan@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [greybus-dev] [PATCH] staging: greybus: fixed the coding style, labels should not be indented.
Date: Fri, 4 Jun 2021 07:34:05 -0500 [thread overview]
Message-ID: <613239d4-c4a6-8585-5f9e-0241f0caa5ec@linaro.org> (raw)
In-Reply-To: <c29b5c97f97b48c894917647915bf510@AcuMS.aculab.com>
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
prev parent reply other threads:[~2021-06-04 12:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 13:36 sh4nnu
2021-06-02 13:43 ` Alex Elder
2021-06-02 14:27 ` Manikishan Ghantasala
2021-06-02 14:37 ` Greg Kroah-Hartman
2021-06-02 14:39 ` Manikishan Ghantasala
2021-06-02 17:26 ` [PATCH] checkpatch: Improve the indented label test Joe Perches
2021-06-02 14:38 ` [PATCH] staging: greybus: fixed the coding style, labels should not be indented Alex Elder
2021-06-03 21:22 ` David Laight
2021-06-03 21:45 ` [greybus-dev] " Alex Elder
2021-06-03 21:48 ` David Laight
2021-06-03 21:55 ` Alex Elder
2021-06-04 8:13 ` David Laight
2021-06-04 8:26 ` Joe Perches
2021-06-04 8:33 ` David Laight
2021-06-04 12:34 ` Alex Elder [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=613239d4-c4a6-8585-5f9e-0241f0caa5ec@linaro.org \
--to=elder@linaro.org \
--cc=David.Laight@ACULAB.COM \
--cc=elder@ieee.org \
--cc=elder@kernel.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=manikishanghantasala@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®