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

Re: [PATCH] Get-Locations TNG Rev. 26 - Using the New Specification

From: Shlomi Fish <shlomif_at_iglu.org.il>
Date: 2004-04-29 22:38:43 CEST

On Thursday 29 April 2004 23:13, Alon Ziv wrote:
> On Thursday 29 April 2004 20:22, Shlomi Fish wrote:
> > > + if (a < b)
> > > + {
> > > + return 1;
> > > + }
> > > + else if (a > b)
> > > + {
> > > + return (-1);
> > > + }
> > > + else
> > > + {
> > > + return 0;
> > > + }
> > >
> > > Twelve lines where one would do:
> > >
> > > return (a < b) ? 1 : (a > b) ? -1 : 0;
> >
> > OK.
>
> Even better (IMO) would be just "b - a" (considering this is just used as a
> comparison function for qsort)...
>

The problem with this suggestion is that we risk overflowing the expression.
And svn_revnum_t is not guaranteed to be the same type as "int".

Regards,

        Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish shlomif@iglu.org.il
Homepage: http://shlomif.il.eu.org/

Quidquid latine dictum sit, altum viditur.
        [Whatever is said in Latin sounds profound.]

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Apr 29 22:34:14 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.