all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* (unknown)
@ 2012-06-29 13:20 Eli Zaretskii
  2012-06-29 14:18 ` ptrdiff_t misuse [was :Re: (empty)] Dmitry Antipov
  0 siblings, 1 reply; 38+ messages in thread
From: Eli Zaretskii @ 2012-06-29 13:20 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-devel

Dmitry, could you please explain the reason(s) for the change below?

Vertical positions in a window can never be large enough to justify
using ptrdiff_t (on platforms where that is wider than a 32-bit
'int').  These are pixel positions on the Emacs display, so they
cannot be too large.  The type of 'first_vpos' looks especially
strange, since it is explicitly set to 1 at most.  I'm not aware of a
platform where an 'int' is not wide enough for a value 1 ;-)

Using inappropriate data types makes the code harder to read and
understand, because it hints that something non-obvious is going on
somewhere.

	 * xdisp.c (try_window_id): Change type of 'first_vpos' and 'vpos'
	 to ptrdiff_t.

  --- src/xdisp.c 2012-06-28 12:29:37 +0000
  +++ src/xdisp.c 2012-06-29 11:48:08 +0000
  @@ -17761,8 +17761,8 @@ try_window_id (struct window *w)
       {
	 /* Displayed to end of window, but no line containing text was
	   displayed.  Lines were deleted at the end of the window.  */
  -      int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0;
  -      int vpos = XFASTINT (w->window_end_vpos);
  +      ptrdiff_t first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0;
  +      ptrdiff_t vpos = XFASTINT (w->window_end_vpos);
	 struct glyph_row *current_row = current_matrix->rows + vpos;
	 struct glyph_row *desired_row = desired_matrix->rows + vpos;



^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2012-07-07 15:34 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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                             ` ptrdiff_t misuse Eli Zaretskii
2012-07-06 14:51                               ` 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

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.