Re: [PATCH] 2.4.22pre10: {,un}likely_p() macros for pointers

From: Willy Tarreau
Date: Mon Aug 11 2003 - 00:36:00 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/