Re:Subtraction is not comparison
by salmonellaeater on Friday December 26, 2014 @04:16AM
(#8798514)
One way to reduce the chance of this problem occurring is to change the specification of the comparison function to only allow -1, 0, and 1 to be returned (or even better, use enums like LESS, EQUAL, GREATER). This makes doing the wrong thing more cumbersome when implementing a comparison function, but it also makes it easier to implement the actual sort function because jump tables and switch statements become possibilities.
[ Parent
| on HN ]
There are no comments on this comment yet.