Re: [IDEA+RFC] Possible solution for min()/max() war

David Woodhouse (dwmw2@infradead.org)
Fri, 31 Aug 2001 00:16:07 +0100


root@chaos.analogic.com said:
> /tmp/xxx.c:9: warning: signed and unsigned type in conditional expression
> As you can see, the casts are !!!IGNORED!!! in gcc 2.96.

No, if the casts were ignored, it would complain:
/tmp/xxx.c:9: warning: comparison between signed and unsigned

What gcc 2.96 is complaining about is not the comparison in the
condition, but the the fact that the two possible
results of your conditional expression (x?a:b) are different.

Change it to read:
#define MIN(a, b) ((a) < (b) ? (int)(a) : (int)(b))
... and you'll see the warning you thought you saw before.

#define MIN(a, b) ((a) < (b) ? (a) : (b))
... and you'll see both.

--
dwmw2

- 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/