[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: EMACS_INT vs int for range checking
From: |
Eli Zaretskii |
Subject: |
Re: EMACS_INT vs int for range checking |
Date: |
Sat, 26 May 2012 13:11:46 +0300 |
> Date: Sat, 26 May 2012 02:13:48 -0700
> From: Paul Eggert <address@hidden>
> CC: Emacs Development <address@hidden>
>
> It's true that 'val' is supposed to be in range here, and
> that if it is in range then 'int' will do. But the point of
> the test '(v < 0 || v > MAX_CHAR)' is to abort if there is
> some programming error somewhere that causes 'val' to be out of
> range. Unfortunately the patch means the abort test won't
> work reliably on a typical 64-bit host if XINT (val) is (say) 2**32,
> which means that the programming error won't be detected reliably.
That's not what that test is about. That test is about making sure
the result is a valid character code.
If we need protection against overflowing a 32-bit int, it should be
part of CHAR_TABLE_REF, not in every place where CHAR_TABLE_REF is
used.