Re: [patch 1/1] consolidate TRUE and FALSE

David Wagner
2006-03-16T23:53:50Z

Randy.Dunlap wrote:
>nah, the only place that using symbolic names for true and false
>is a problem is when someone #defines or enums them bassackwards.

Here's another danger associated with #define TRUE:
int x = ...;
if (x == TRUE)
do_something();
A surprise happens if x is initialized to something other than 0 or 1.
Looks like there maybe as many as a hundred instances of the above
pattern in the kernel. Most of them seem safe, but I don't know whether
they all are, and there are too many for me to check them all.

For instance, take a look at net/core/ethtool.c:ethtool_set_rx_csum()
and drivers/net/ixgb/ixgb_ethtool.c:ixgb_set_rx_csum() and
drivers/net/ixgb/ixgb_main.c:ixgb_configure_rx() for how it handles
adapter->rx_csum to see one example that strikes me as dubious.