Comparator.
For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
if x == y. This is useful for instance in a qsort comparator callback.
Furthermore, compilers are able to optimize this to branchless code, and
there is no risk of overflow with signed types.
As with many macros, this evaluates its argument multiple times, it thus
must not have a side-effect.
Comparator. For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 if x == y. This is useful for instance in a qsort comparator callback. Furthermore, compilers are able to optimize this to branchless code, and there is no risk of overflow with signed types. As with many macros, this evaluates its argument multiple times, it thus must not have a side-effect.