lkml.org 
[lkml]   [2003]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.072 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site