On Sat, Mar 02, 2013 at 10:22:46PM -0800, Junio C Hamano wrote:
> Andreas Schwab <[email protected]> writes:
>
> > You should always cast to unsigned char when determining the order of
> > characters, to be consistent with strcmp/memcmp.
>
> We treat runs of digits as numbers, so it is not even similar to
> strcmp. As long as it is internally consistent (i.e. the return
> value inside the loop (*a - *b) must match the last return), it
> should be OK, no?
I almost responded and said something similar, but we also do byte-wise
comparisons for non-numeric elements, and we would want those to match
what other programs may do (and what git used to do).
I highly doubt that it matters in practice, as it would mean:
1. The sorting of a maildir's filenames are dependent on the sorting
of non-numeric bits. We can't rule out such a scheme, but I'd guess
implementations either use numbers, or their sort order is
meaningless (and that is what I found in the ones I looked at).
2. The importantly-sorted bits contain non-ascii characters (the
difference is only seen when we go outside the signed range).
but it doesn't hurt to be thorough (and to set a good example).
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html