Re: Maximum string size?

Chris Angelico <[email protected]> Tue, 11 Jul 2017 02:33:00 +1000
Newsgroups gmane.comp.lang.pike.user
Message-ID <CAPTjJmrko90ra6sBaDfQtn6m7vm72xtcjC1JFhT-sPqXN5SQ=w@mail.gmail.com>
On Tue, Jul 11, 2017 at 2:13 AM, Arne Goedeke <[email protected]> wrote:
> Hi,
>
> internally the string size is represented by a ptrdiff_t, so in
> principle you should be able to handle more than 2GB (at least on 64 bit
> systems). However, there are some APIs which do not handle large strings
> correctly, e.g. Stdio.read_file() on a file which is larger than INT_MAX
> will only return the first INT_MAX bytes.
>
> Probably what you are seeing here is an API, which is somehow using
> 'int' internally. Or something similar. In my opinion, all those cases
> are bugs and should be fixed. So if you could find out what specifically
> went wrong in your case, that would be useful.

Hmm, okay. For reference, here's the entire program:

https://github.com/Rosuav/RollingShutter

I'll try to create a minimal test case that uses Process.run() and see
if I can make it fail. It's possible there's a limit inside
Shuffler.Shuffler, which Process.run uses internally to send stdin to
the subprocess.

ChrisA