From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Rientjes <rientjes@google.com>,
Mel Gorman <mgorman@suse.de>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [patch 3.5-rc3] mm, mempolicy: fix mbind() to do synchronous migration
Date: Thu, 21 Jun 2012 19:22:30 -0700 [thread overview]
Message-ID: <CA+55aFzioa__XftM7GOh2_iz0ukrTqx1QDaYV=DhiQC4f6nC_w@mail.gmail.com> (raw)
In-Reply-To: <20120621184536.6dd97746.akpm@linux-foundation.org>
On Thu, Jun 21, 2012 at 6:45 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
>
> And casts to/from bool, perhaps. To squish the warning we'd do things
> like a_bool = !!a_int. That generates extra code, but gcc internally
> generates extra code for a_bool = a_int anyway, and a quick test here
> indicates that the generated code is identical (testl/setne).
It *has* to generate extra code. A cast to Bool is very much not at
all like a normal cast. All the traditional C casts just do a pure bit
truncate (or zero/sign extension) keeping the same value.
A cast to bool is totally different. It is exactly the same as "test
against zero" - so it in no way acts like a traditional integer cast
to a one-bit integer.
I'm not 100% sure the use of "bool" is a great idea, and people who
use pointers to bools are crazy mf's (you can break the fundamental
property of bools by assigning random values through the pointer), but
_Bool certainly ahs the _potential_ to be a good thing. The reason I'm
nervous about it is exactly that people get it wrong so easily because
they do *not* act like any other C type (the whole pointer-to-bool
thing being one example of people doing bad things - I personally
would be much happier if _Bool acted more like a one-bit bitfield and
could not have its address taken).
Linus
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-06-22 2:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-21 1:00 David Rientjes
2012-06-21 12:42 ` Mel Gorman
2012-06-21 23:46 ` Andrew Morton
2012-06-22 0:46 ` Linus Torvalds
2012-06-22 1:45 ` Andrew Morton
2012-06-22 2:22 ` Linus Torvalds [this message]
2012-06-22 3:33 ` Linus Torvalds
2012-06-22 3:59 ` Linus Torvalds
2012-06-22 7:12 ` Ingo Molnar
2012-06-22 7:41 ` Ingo Molnar
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='CA+55aFzioa__XftM7GOh2_iz0ukrTqx1QDaYV=DhiQC4f6nC_w@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mingo@elte.hu \
--cc=rientjes@google.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