top/contents search
This version of mystructcmp uses explicit comparisons, rather than the more obvious subtractions, to decide whether to return a negative, zero, or positive value. In general, it's safer to write comparison functions this way: subtraction can easily overflow (and cause either an abort or a quiet wrong answer) when a very large positive number is compared with a very large negative number. (Of course, in this example, overflow would be unlikely in any case.)


contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North