[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn_repos_trace_node_locations()

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2004-06-11 13:46:51 CEST

On Fri, 11 Jun 2004, [UTF-8] Branko Ä^Libej 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, and the
modulo 2 rule 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.

//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jun 11 14:27:29 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.