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: Thu, 05 Jul 2012 22:34:59 +0300

Btw, what's the theory behind using ptrdiff_t in preference to
EMACS_INT to store values that came from Lisp?  E.g., in this snippet:

  static Lisp_Object
  set_window_hscroll (struct window *w, EMACS_INT hscroll)
  {
    ...
    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?
It looks like EMACS_INT is always preferable in these contexts, as it
always has the right width.

Likewise for variables that store buffer or string positions.

What am I missing?



reply via email to

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