[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: Greg Hudson <ghudson_at_MIT.EDU>
Date: 2004-06-11 17:42:08 CEST

On Fri, 2004-06-11 at 07:46, Peter N. Lundblad wrote:
> On Fri, 11 Jun 2004, [UTF-8] Branko ^Libej wrote:
> > >+ 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,

I think we're already fairly sunk on platforms where signed overflow is
signalled, so we're not worried about that. But we could produce the
wrong answer in such a case, which is why I never suggested using b - a.

Thinking about it again, since we're not expecting any negative revision
numbers, I think b - a is safe. (The difference between two positive
members of a signed type is always representable within the range of the
signed type.) But that reasoning probably deserves a comment if we use
it, at which point the code becomes just as long as it already is.

(If we were dealing in unsigned numbers, then of course subtraction
would be right out, since the result would never be negative.)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jun 11 17:42:51 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.