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