[Top][All Lists]

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

bug#34781: 27.0.50; integer in pcase sometimes compared by eq

From: Paul Eggert
Subject: bug#34781: 27.0.50; integer in pcase sometimes compared by eq
Date: Thu, 28 Mar 2019 15:10:14 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0

> +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 =

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.

reply via email to

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