From: Valdis.Kletnieks@vt.edu (Valdis.Kletnieks at vt.edu)
To: kernelnewbies@lists.kernelnewbies.org
Subject: ternary vs double exclamation
Date: Sat, 03 Jan 2015 23:20:29 -0500 [thread overview]
Message-ID: <37532.1420345229@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Sat, 03 Jan 2015 18:54:00 -0500." <20150103235359.GA3588@vega.jjdev.com>
On Sat, 03 Jan 2015 18:54:00 -0500, John de la Garza said:
> It should not be assumed that true will always be 1 as defined in
> include/linux/stddef.h, right?
No, I mean use an actual 'bool' type rather than 'int'. Consider this from
kernel/softirq.c:
static inline bool lockdep_softirq_start(void)
{
bool in_hardirq = false;
if (trace_hardirq_context(current)) {
in_hardirq = true;
trace_hardirq_exit();
}
lockdep_softirq_enter();
return in_hardirq;
}
However, this will require actual code analysis to make sure that it's
*really* being used as a boolean, not an int. In particular, assignments
to/from the variable need to be audited for casting issues (and possibly
the correct rework is to convert *several* variables to bool at once).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150103/ae4843b6/attachment.bin
next prev parent reply other threads:[~2015-01-04 4:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-30 0:25 ternary vs double exclamation Vinícius Tinti
2014-12-30 0:34 ` Max Filippov
2014-12-30 0:40 ` Vinícius Tinti
2014-12-30 1:00 ` Valdis.Kletnieks at vt.edu
2014-12-30 1:04 ` Vinícius Tinti
2015-01-03 23:54 ` John de la Garza
2015-01-04 4:20 ` Valdis.Kletnieks at vt.edu [this message]
2015-01-04 23:43 ` John de la Garza
2015-01-05 0:50 ` Greg KH
2015-01-08 4:46 ` John de la Garza
2015-01-08 6:37 ` Greg KH
2015-01-05 1:17 ` Valdis.Kletnieks at vt.edu
2015-01-08 4:58 ` John de la Garza
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=37532.1420345229@turing-police.cc.vt.edu \
--to=valdis.kletnieks@vt.edu \
--cc=kernelnewbies@lists.kernelnewbies.org \
/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;
as well as URLs for NNTP newsgroup(s).