Messages in this thread | | | Date | Wed, 6 Sep 2000 11:39:59 -0500 | From | Bill Wendling <> | Subject | Re: linux-2.4.0-test8-pre5 |
| |
Also sprach Dan Aloni: } On Wed, 6 Sep 2000, Peter Samuelson wrote: } } > Can someone explain this line from the VIA update? } > #define FIT(v,min,max) (((v)>(max)?(max):(v))<(min)?(min):(v)) } > Barring side effects on the variables, it is equivalent to } > #define FIT(v,min,max) ((v)<(min)?(min):(v)) } > } > Why do I get the feeling that this was *not* the intent? } } Correct. The last v should be replaced with whatever that we got from } (v)>(max)?(max):(v), like: } } #define FIT(v,min,max) (((v)>(max)?(max):(v))<(min)?(min):((v)>(max)?(max):(v))) } } Or perhaps this is a lot better: } } #define FIT(v,min,max) ((v)>(max)?(max):((v)<(min)?(min):(v))) } *pukes*
Wouldn't an inline'd function be much much more readable/maintainable??
-- || Bill Wendling wendling@ganymede.isdn.uiuc.edu - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
| |