Hi,
if (likely(stru->pointer))
results in an ugly warning about using pointer as int.
Is there something that could be done against that ?
Regards
Oliver
> if (likely(stru->pointer))
>
> results in an ugly warning about using pointer as int.
> Is there something that could be done against that ?
if (likely(stru->pointer == NULL))
Perhaps ?
On Sunday 13 January 2002 16:07, Alan Cox wrote:
> > if (likely(stru->pointer))
> >
> > results in an ugly warning about using pointer as int.
> > Is there something that could be done against that ?
>
> if (likely(stru->pointer == NULL))
>
> Perhaps ?
That works. But it's so much work to type it.
Regards
Oliver
[email protected] (Oliver Neukum) writes:
> Hi,
>
> if (likely(stru->pointer))
>
> results in an ugly warning about using pointer as int.
> Is there something that could be done against that ?
Just use
if (!stru->pointer) {
...
}
instead. gcc and a lot of other compilers predict all pointer tests
against NULL as unlikely, unless you override that.
-Andi (who is a bit worried about the unlikelies multiplicating like rabbits)
On Sun, 2002-01-13 at 12:27, Andi Kleen wrote:
> -Andi (who is a bit worried about the unlikelies multiplicating like rabbits)
Indeed. People need to realize unlikely is not a free ride.
Robert Love
Alan Cox wrote:
>
> > if (likely(stru->pointer))
> >
> > results in an ugly warning about using pointer as int.
> > Is there something that could be done against that ?
>
> if (likely(stru->pointer == NULL))
>
-#define likely(x) __builtin_expect((x),1)
-#define unlikely(x) __builtin_expect((x),0)
+#define likely(x) __builtin_expect((x)!=0,1)
+#define unlikely(x) __builtin_expect((x)!=0,0)
?