On Sat, Jun 16, 2012 at 09:32:50AM -0700, Linus Torvalds wrote: > On Fri, Jun 15, 2012 at 11:55 PM, Xi Wang <xi.wang@xxxxxxxxx> wrote: > > Casting to _Bool requires a zero test rather than truncation. > > Ack. _Bool is very special (and rather non-C-like). > > > BTW, this patch also disables the warning "cast truncates bits from > > constant value". Does that sound good? > > For cast to _Bool, that is correct. Since it doesn't truncate the > value, the upper bits are not ignored as they are with other casts. > It's pretty rare to see a cast to bool that truncates the value. My feeling is that most times they are bugs. I just saw one of these a couple weeks ago: http://www.spinics.net/lists/linux-iio/msg05573.html I wish the error message could be fixed so it says 1 instead of 0. old: warning: cast truncates bits from constant value (2 becomes 0) new: warning: cast truncates bits from constant value (2 becomes 1) regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html