Messages in this thread | | | Date | Wed, 13 Aug 2003 20:42:01 +0100 | From | Jamie Lokier <> | Subject | Re: [PATCH] 2.4.22pre10: {,un}likely_p() macros for pointers |
| |
Albert Cahalan wrote: > > Being a simple soul, I prefer __builtin_expect((x) != 0, 1). > > That's much harder to read. The !! is a nice > neat idiom. The other way requires a bit of thought. > (is that == or !=, a 0 or 1, and what does that > compute to?) > > The !! is visually distinctive. It has only one use. > When you see it, you instantly know that a value is > being converted to the pure boolean form.
Dear Albert,
I have to tell you your are totally wrong :)
Most C programmers will find "!!x" less clear than "x != 0", simply because "!!x" isn't used all that much.
If you require significant thought to parse "x != 0" you are going to have trouble with more complex idioms.
Like "x && 1" and "x || 0", which are obvious to anyone :)
-- Jamie - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |