Re: [patch 3.5-rc3] mm, mempolicy: fix mbind() to do synchronous migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 21, 2012 at 6:45 PM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]