Wednesday, January 8, 2014

Re: Question about integer size and limits

On Wednesday, January 8, 2014 8:30:42 AM UTC-6, glts wrote:
> On Wednesday, January 8, 2014 12:47:25 PM UTC+1, Ken Takata wrote:
> > 2014/1/8 Wed 4:41:07 UTC+9 glts wrote:
> > > ":h limits" says that for maximum line length and max number of lines
> > > the number 2147483647 is the hard limit.
> > >
> > > For range of a number value (and maximum file size), however, it says
> > > 2147483647 or "more".
> > >
> > > I see in the typedef for varnumber_T that on modern machines it will be
> > > defined as "int". Now I wonder, can this ever be "more" than 2^31-1? Are
> > > there any circumstances (compile flags/architectures) where (for
> > > example) a Vim number could be greater than 2^31-1?
> >
> > You may find the same discussion at here:
> > https://groups.google.com/d/topic/vim_dev/p8Fl_vJDGy8/discussion
>
> Thank you for the pointer.
>
> I had seen the discussion and realise that some people need an int64.
>
> But what I'm really interested in is the current state of affairs. I
> wrote a little Vim script the other day where I assumed MAX_INT to be
> 2147483647. The help says that it is possible that MAX_INT is greater
> than that. I don't know if that is true given the current code. I
> believe it isn't, but I'm not sure.
>

I think the point of that note in the help, is that it COULD increase to a larger maximum at some later time. Therefore, you should not make any assumptions on the max value. You can depend on numbers always being able to store at least that much, but you can't depend on that always being the limit.

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment