[Top][All Lists]

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

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

From: Stefan Monnier
Subject: Re: ptrdiff_t misuse [was :Re: (empty)]
Date: Fri, 29 Jun 2012 13:07:33 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

> Argh, I misuse them against window_end_pos and window_end_bytepos,
> which are positions in a buffer and so ptrdiff_t :-(.  This should
> be reverted.

Not only there: hscroll and min_hscroll should be `int' fields.
And similarly Paul's "fix" to use:

  ptrdiff_t clipped_arg
    = clip_to_bounds (- w->hscroll, requested_arg, HSCROLL_MAX - w->hscroll);

should be reverted.  Really, if someone ever bumps into a problem
because of such an overflow, I'll be *super* happy, because it means
that all the performance problems we get with long lines have
been fixed.

Properly catching/handling integer overflows is a good idea, but C makes
it much too painful in general, so we don't want to do it in
unrealistic corner cases, preferring code cleanliness.


reply via email to

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