From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel@gnu.org
Subject: Re: EMACS_INT vs int for range checking
Date: Sat, 26 May 2012 13:11:46 +0300 [thread overview]
Message-ID: <8362bjw8t9.fsf@gnu.org> (raw)
In-Reply-To: <4FC09ECC.5050206@cs.ucla.edu>
> Date: Sat, 26 May 2012 02:13:48 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: Emacs Development <emacs-devel@gnu.org>
>
> 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.
next prev parent reply other threads:[~2012-05-26 10:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-26 9:13 EMACS_INT vs int for range checking Paul Eggert
2012-05-26 10:11 ` Eli Zaretskii [this message]
2012-05-26 19:05 ` Paul Eggert
2012-05-27 6:19 ` Eli Zaretskii
2012-05-27 7:34 ` Paul Eggert
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=8362bjw8t9.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
/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.