On 5/17/24 12:57 PM, Grisha Levit wrote:
The current cmp implementation for size and blocks subtracts the two
values and returns the difference as an int. This subtraction can
overflow, and the returned int can end up having the wrong sign.

This also makes the qsort comparison function non-transitive. (Some
interesting discussion on that at [1]).

Thanks for the report. If overflow is a concern, then a guaranteed
transitive comparison function is the right thing. Your solution is clever,
but a little obscure; I think I'll make it look more like the other
comparison functions.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to