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

Re: svn commit: r17273 - in branches/svndiff1/subversion: libsvn_delta mod_dav_svn

From: Daniel Berlin <dberlin_at_dberlin.org>
Date: 2005-11-10 03:51:44 CET

On Thu, 2005-11-10 at 01:29 +0000, Philip Martin wrote:
> Daniel Berlin <dberlin@dberlin.org> writes:
>
> >> > Author: dberlin
> >> > Date: Wed Nov 9 11:51:14 2005
> >> > New Revision: 17273
> >>
> >> > +static int sort_encoding_pref(const void *accept_rec1, const void
> >> *accept_rec2)
> >> > +{
> >> > + float diff = ((accept_rec *) accept_rec1)->quality -
> >> > + ((accept_rec *) accept_rec2)->quality;
> >>
> >> I cast to (const accept_rec *) to avoid dropping const.
> >>
> > You know that this can't do anything interesting in C, right, because of
> > the rules of whether const matters or not? Sad, but true.
>
> To which rules are you referring?

To summarize, a compiler basically can't do anything interesting with
const unless it can prove the object was originally declared const (IE
the originally object being given to us, wherever the hell that was)
> Something to do with modifiable
> lvalues perhaps? I know it makes no difference in this particular
> case, but casting away const always raises an alarm and gives the
> reader (well me anyway) something extra to think about.
>
> > However, it "looks" better, so i'll do it.
>
> That's why I'd do it.

Yup.
Like i said, it was originally dlr's code, and i didn't bother to look
too good at it (mod_dav_svn is, uh, an interesting piece of code).

>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 10 03:52:13 2005

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.