unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* integer-width
@ 2018-08-29  3:44 Stefan Monnier
  2018-08-29  4:47 ` integer-width Eli Zaretskii
  2018-08-29  9:31 ` integer-width Paul Eggert
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Monnier @ 2018-08-29  3:44 UTC (permalink / raw)
  To: emacs-devel


I see integer-width is set to 65536, and NEWS mentions this var and what
is its effect, but I can't find any documentation for the reason behind
the existence of this variable nor the choice of its default value.

E.g. would there be harm in setting it to most-positive-fixnum?


        Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: integer-width
  2018-08-29  3:44 integer-width Stefan Monnier
@ 2018-08-29  4:47 ` Eli Zaretskii
  2018-08-29  9:31 ` integer-width Paul Eggert
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2018-08-29  4:47 UTC (permalink / raw)
  To: emacs-devel, Stefan Monnier

On August 29, 2018 6:44:15 AM GMT+03:00, Stefan Monnier <monnier@IRO.UMontreal.CA> wrote:
> 
> I see integer-width is set to 65536, and NEWS mentions this var and
> what
> is its effect, but I can't find any documentation for the reason
> behind
> the existence of this variable nor the choice of its default value.


The reason for the existence of this variable is explicitly explained
in the NEWS entry.  I'm not sure I understand how you missed it.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: integer-width
  2018-08-29  3:44 integer-width Stefan Monnier
  2018-08-29  4:47 ` integer-width Eli Zaretskii
@ 2018-08-29  9:31 ` Paul Eggert
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2018-08-29  9:31 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

Stefan Monnier wrote:
> I see integer-width is set to 65536, and NEWS mentions this var and what
> is its effect, but I can't find any documentation for the reason behind
> the existence of this variable nor the choice of its default value.

The manual says, "Setting this variable to zero disables creation of bignums; 
setting it to a large number can cause Emacs to consume large quantities of 
memory if a computation creates huge integers." Should this be expanded, and if 
so, what's needed?

I chose 65536 in an attempt at a sensible compromise between values too small 
(useful integers cannot be computed) and too large (Emacs thrashes). I didn't do 
a full engineering analysis to come up with that number, and am not wedded to it.

> would there be harm in setting it to most-positive-fixnum?

The harm would be that Emacs could thrash due to numeric computation (enabling 
some DoS attacks).

While we're on the topic, there are some theoretical limits other than 
integer-width. Integers can't contain more than most-positive-fixnum bits, not 
only because integer-width is limited to a fixnum, but also because of other 
internal limits within Emacs. Some internal limits are imposed by libgmp (e.g., 
integers can't contain more than ULONG_MAX bits, or more than INT_MAX * 
ULONG_WIDTH bits). I didn't put this stuff into the documentation because these 
are implementation details that we should hide from users and besides these 
integers are so outlandishly large that Emacs will surely thrash before users 
run into them.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-29  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-29  3:44 integer-width Stefan Monnier
2018-08-29  4:47 ` integer-width Eli Zaretskii
2018-08-29  9:31 ` integer-width Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).