bigger then size_t

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Oct 9 10:08:03 PDT 2012


On 09-Oct-12 19:35, Adam D. Ruppe wrote:
> On Tuesday, 9 October 2012 at 15:56:15 UTC, maarten van damme wrote:
>> Wouldn't a user then be able to launch that program followed by the
>> contents of a big file of say 5 gig.
>
> The operating system won't allow that. There's a limit on argument sizes
> enforced before the program actually runs.

I'll just add the follwoing:

And how do you think shell does call program? Via syscall(s). And that 
syscall is just like (+- internal details) a normal C function call. And 
thus all arguments are always loaded into RAM first in *any* case.

It's up to this program (shell, or whatever executes your program) to 
load that. And it will either truncate command line or fail itself.

Also OS have some sane limits on command line length. IRC it's around 
32768 in Windows.

-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list