Den torsdag 21 april 2016 kl. 17:37:54 UTC+2 skrev Bram Moolenaar:
> Max Lekare wrote:
>
> > There is no handling for limits or stride greater/smaller than
> > LONG_MAX/LONG_MIN in the range() function.
> > Instead the results vary from the error message "E727: Start past end"
> > when at least one of the arguments are close to the limit ex:
> >
> > :put =range(2147483647,2147483648)
> >
> > to an output of a seemingly random list of negative numbers, ex:
> >
> > :put =range(2220500000,2220600000)
> >
> > to vim crashing when arguments are too long.
> > The same behavior can be observed when trying to accomplish a similar
> > thing with a for loop.
> >
> > :for i in range(2220500000,2220600000) | put=i | endfor
> >
> > Is it possible to validate the input to avoid this behavior?
>
> range() was meant to be used for smaller numbers. The behavior with big
> numbers depends on the compiler, size of int. So ranges outside of 32
> bit signed int is undefined.
>
> Vim should not crash though. What command crashes your Vim?
>
> --
> The question is: What do you do with your life?
> The wrong answer is: Become the richest guy in the graveyard.
> (billionaire and Oracle founder Larry Ellison)
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\ an exciting new programming language -- http://www.Zimbu.org ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
When entering something really big, like
:put =range(30000000000,300000000000000000000)
Vim quits with message
Vim: Caught deadly signal SEGV
Vim: Finished.
[1] 75479 segmentation fault \vim
%
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.