From: Arnd Bergmann <arnd@arndb.de>
To: outreachy-kernel@googlegroups.com
Cc: Julia Lawall <julia.lawall@lip6.fr>,
Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Subject: Re: [Outreachy kernel] [PATCH] Staging: rtl8192u: Simplify if condition.
Date: Tue, 24 Feb 2015 22:35:34 +0100 [thread overview]
Message-ID: <6220123.OEaHGpHvmv@wuerfel> (raw)
In-Reply-To: <alpine.DEB.2.02.1502242219480.2081@localhost6.localdomain6>
On Tuesday 24 February 2015 22:24:23 Julia Lawall wrote:
> On Tue, 24 Feb 2015, Ksenija Stanojevic wrote:
>
> > Remove unnecessary TRUE statement. Fields bDynamicTxLowPower and
> > bDynamicTxHighPower are of bool type so such change is correct.
>
> I'm not sure that the compiler actually enforces that a bool variable is
> only ever assigned to 0 or 1. The kernel contains the following in
> types.h:
>
> typedef _Bool bool;
>
> The following (non-kernel) C program compiles with gcc with no errors:
>
> _Bool x;
>
> int main () {
> x = 12;
> }
>
> To be on the safe side, you should look at each place where the field is
> initialized and check that the value is true or false. If that is what
> you have already done, then you should expand on the commit message to
> make that more apparent.
Actually C enforces this:
_Bool x;
int main()
{
x = 12;
if (x == 1)
return 1;
else
return 2;
}
The compiler ensures that this program returns 1, not 2.
Arnd
next prev parent reply other threads:[~2015-02-24 21:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 20:54 [PATCH] Staging: rtl8192u: Simplify if condition Ksenija Stanojevic
2015-02-24 21:24 ` [Outreachy kernel] " Julia Lawall
2015-02-24 21:35 ` Arnd Bergmann [this message]
2015-02-25 6:34 ` Julia Lawall
2015-02-25 6:40 ` Julia Lawall
2015-02-25 7:49 ` Ksenija Stanojević
-- strict thread matches above, loose matches on Subject: below --
2015-03-04 23:32 Ksenija Stanojevic
2015-03-05 1:37 ` [Outreachy kernel] " Jes Sorensen
2015-03-05 15:58 ` Ksenija Stanojević
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=6220123.OEaHGpHvmv@wuerfel \
--to=arnd@arndb.de \
--cc=julia.lawall@lip6.fr \
--cc=ksenija.stanojevic@gmail.com \
--cc=outreachy-kernel@googlegroups.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 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.