I want such a macro in my project: cmp(x, y) returns a positive number when x > y, a negative number when x < y, and 0 when x == y. of course I know the simplest way:
but this cannot work properly for the code like cmp(x++, y++). Can this limit be fixed?Code:#define cmp(x, y) (((x) > (y)) ? 1 : (((x) == (y)) ? 0 : -1))