lkml.org 
[lkml]   [2003]   [Aug]   [11]   [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
On Sun, Aug 10, 2003 at 10:39:12PM -0400, Chip Salzenberg wrote:

> Both parameters of __builtin_expect() are long ints. On an
> architecture where there's a pointer type larger than long[1],
> __builtin_expect() won't just warn, it'll *fail*. Also, on an
> architecture where a conversion of a null pointer to long results in
> a non-zero value[2], it'll *fail*. That makes it non-portable twice
> over. Wouldn't you agree?

Hmmm Chip, on the document you suggested us to read, I remember a statement
about (!x) <=> (x == 0) which implied it's legal even if x is a pointer because
the compiler will automatically do the comparison between x and NULL and not
(int)x and 0. Perhaps I have dreamed, but I'm sure I read this. So in any case,
the !!(x) construct should be valid.

Cheers,
Willy

-
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.079 / U:1.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site