emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ptrdiff_t misuse [was :Re: (empty)]


From: Eli Zaretskii
Subject: Re: ptrdiff_t misuse [was :Re: (empty)]
Date: Fri, 06 Jul 2012 09:43:06 +0300

> Date: Thu, 05 Jul 2012 17:08:50 -0700
> From: Paul Eggert <address@hidden>
> CC: address@hidden, address@hidden, address@hidden
> 
> On 07/05/2012 12:34 PM, Eli Zaretskii wrote:
> >     ptrdiff_t hscroll_max = min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX);
> >     ptrdiff_t new_hscroll = clip_to_bounds (0, hscroll, hscroll_max);
> > 
> > Won't this do The Wrong Thing when Emacs is configured with wide ints?
> 
> No, because hscroll_max and new_hscroll cannot
> exceed PTRDIFF_MAX (the above code guarantees
> this directly), so their values therefore always fit
> in ptrdiff_t range even when EMACS_INT is wider than
> ptrdiff_t.

Yes, but why do that in the first place?  The value of 'hscroll' comes
from Lisp, so it's in the range of an EMACS_INT.  Why not treat it as
such?

For that matter, why not change 'hscroll' in 'struct window' to
EMACS_INT as well?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]