From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: dmantipov@yandex.ru, monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: ptrdiff_t misuse
Date: Fri, 06 Jul 2012 11:34:37 +0300 [thread overview]
Message-ID: <83k3yh2spu.fsf@gnu.org> (raw)
In-Reply-To: <4FF69476.2070701@cs.ucla.edu>
> Date: Fri, 06 Jul 2012 00:32:06 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: dmantipov@yandex.ru, monnier@iro.umontreal.ca, emacs-devel@gnu.org
>
> On 07/05/2012 11:43 PM, Eli Zaretskii wrote:
> > 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?
>
> I would prefer that, yes. Although Stefan said last week that
> hscroll should be 'int'
> <http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00603.html>
> on the grounds that hscroll values greater than INT_MAX don't work
> anyway, perhaps that's moot now that you've fixed those problems with
> large hscroll values.
Stefan, do you object to making hscroll (and other values that come
from Lisp) EMACS_INT?
I think doing so will naturally and easily avoid the messy tests
against max values of several data types where we want to clip values
to some reasonable range. So I think it will be a net win in code
clarity and maintainability, and will prevent subtle bugs.
> If we change hscroll to EMACS_INT, we should also increase the max
> hscroll value to MOST_POSITIVE_FIXNUM.
It's already that:
ptrdiff_t hscroll_max = min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX);
ptrdiff_t new_hscroll = clip_to_bounds (0, hscroll, hscroll_max);
(Of course, if we declare these variables EMACS_INT, PTRDIFF_MAX will
not be needed anymore.)
Or did you mean something else?
next prev parent reply other threads:[~2012-07-06 8:34 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-29 13:20 (unknown) Eli Zaretskii
2012-06-29 14:18 ` ptrdiff_t misuse [was :Re: (empty)] Dmitry Antipov
2012-06-29 17:07 ` Stefan Monnier
2012-06-30 7:13 ` Paul Eggert
2012-06-30 7:27 ` Eli Zaretskii
2012-06-30 13:12 ` Paul Eggert
2012-06-30 14:23 ` Stefan Monnier
2012-06-30 12:07 ` Stefan Monnier
2012-06-30 13:14 ` Paul Eggert
2012-06-30 14:23 ` Stefan Monnier
2012-07-04 6:25 ` Paul Eggert
2012-07-04 16:39 ` Eli Zaretskii
2012-07-04 18:19 ` Paul Eggert
2012-07-05 16:31 ` Eli Zaretskii
2012-07-05 19:34 ` Eli Zaretskii
2012-07-06 0:08 ` Paul Eggert
2012-07-06 6:43 ` Eli Zaretskii
2012-07-06 7:32 ` Paul Eggert
2012-07-06 8:34 ` Eli Zaretskii [this message]
2012-07-06 14:51 ` ptrdiff_t misuse Paul Eggert
2012-07-06 21:30 ` Stefan Monnier
2012-07-06 21:33 ` Samuel Bronson
2012-07-07 10:59 ` Stefan Monnier
2012-07-07 15:34 ` Paul Eggert
2012-07-06 8:46 ` Eli Zaretskii
2012-07-06 10:19 ` Stephen J. Turnbull
2012-07-06 11:01 ` Eli Zaretskii
2012-07-06 12:02 ` Stephen J. Turnbull
2012-07-06 13:37 ` Eli Zaretskii
2012-07-06 16:25 ` Stephen J. Turnbull
2012-07-06 14:56 ` Paul Eggert
2012-07-06 15:43 ` Eli Zaretskii
2012-07-06 15:56 ` Paul Eggert
2012-07-06 16:00 ` Eli Zaretskii
2012-07-06 16:42 ` Dmitry Antipov
2012-07-06 17:39 ` Paul Eggert
2012-07-07 1:31 ` Chong Yidong
2012-06-29 18:54 ` ptrdiff_t misuse [was :Re: (empty)] Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83k3yh2spu.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=dmantipov@yandex.ru \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.