Peter N. Lundblad wrote:
>>Peter N. Lundblad wrote:
>>
>>And one nit from me:
>>
>>
>>
>>>+/* Compare revision numbers for sorting in decreasing order. */
>>>+static int
>>>+compare_revnums (const void *p_a, const void *p_b)
>>>+{
>>>+ svn_revnum_t a, b;
>>>+ a = *(svn_revnum_t *)p_a;
>>>+ b = *(svn_revnum_t *)p_b;
>>>+
>>>+ return (a < b) ? 1 : (a > b) ? -1 : 0;
>>>+}
>>>
>>>
>>>
>>>
>>Sigh, I'm so tired of seeing people write these verbose comparison
>>expressions... :-)
>>
>> return b - a;
>>
>>
>
>Don't we risk getting an over/underflow exception on platforms where such
>things are signalled? Remember that these are signed numbers,
>
These are signed numbers that are guaranteed to be >= -1.
>and the modulo 2 rule
>
Which rule is that?
>only applies to unsigned integral types if I understand the
>C(++) standard correctly. But you seem to have ISO C available, so you
>might be able to quote some paragraphs...:-)
>
>Please correct me if I'm wrong.
>
>
You're talking about the hypothetical case where b is positive, a is
negative, and b - a > LONG_MAX. In this case, that can only happen if b
== LONG_MAX - 1, and LONG_MAX is at least 2^31 - 1. I'd say we're fairly
safe.
But never mind, let's leave it as it is. At least whoever reads that
will have fun figuring out the C operator precedence rules. :-)
--
Brane Čibej <brane_at_xbc.nu> http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jun 11 18:25:48 2004