GNU bug report logs -
#34781
27.0.50; integer in pcase sometimes compared by eq
Previous Next
Reported by: Mattias Engdegård <mattiase <at> acm.org>
Date: Thu, 7 Mar 2019 15:16:02 UTC
Severity: normal
Tags: patch
Found in version 27.0.50
Done: Mattias Engdegård <mattiase <at> acm.org>
Bug is archived. No further changes may be made.
Full log
Message #40 received at 34781 <at> debbugs.gnu.org (full text, mbox):
>
> +Since the size of fixnums varies between platforms, the new predicate
> +'portable-fixnum-p' can be used to determine whether a number is
> +a fixnum on any machine running the current Emacs version.
The news item should also mention most-negative-portable-fixnum etc. Try
to be terser; e.g., "can be used to determine" -> "determines".
>
> +(defun portable-fixnum-p (object)
> + "Return t if OBJECT is a fixnum on any machine running the current
> +Emacs version."
The usage message can fit on one line.
> + (and (integerp object)
> + (<= most-negative-portable-fixnum object
> most-positive-portable-fixnum)))
integerp -> fixnump
> + DEFVAR_LISP ("most-positive-portable-fixnum",
> + Vmost_positive_portable_fixnum,
> + doc: /* The greatest integer that is represented
> efficiently
> +on any machine running this version of Emacs.
Try to have the first line explain things tersely. Something like "The
largest integer representable as a fixnum on any platform." More details
can be in later lines, if needed.
> + Vmost_positive_portable_fixnum =
> make_fixnum(MOST_POSITIVE_PORTABLE_FIXNUM);
Space before parenthesis (elsewhere, too).
>
> diff --git a/src/lisp.h b/src/lisp.h
> index 178eebed2a..bf1f0a0bf5 100644
> --- a/src/lisp.h
> +++ b/src/lisp.h
These changes should be in data.c not lisp.h, since only data.c needs
them and it's not likely any other code will need them.
>
> +/* The smallest portable value of EMACS_INT_MAX. */
> +#define LEAST_EMACS_INT_MAX 2147483647 /* 2**31 - 1 */
There's no need to make it a macro. Also, the LEAST_* prefix and *_MAX
suffix are confusing: which takes priority? I suggest sticking to
suffixes, since that seems to be the convention. Something like
int EMACS_INT_MAX_MIN = 2147483647;
as a local in the only function that needs it, and similarly for the
related macros. Although you can use 'verify' to check that
EMACS_INT_MAX_MIN <= EMACS_INT_MAX, I'm not sure I'd bother as we're
going to add overflow checking to make_fixnum at some point anyway.
This stuff should be documented in the manual, too, next to the
documentation of most-positive-fixnum and fixnump respectively.
Thanks again for taking this on.
This bug report was last modified 6 years and 115 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.