Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] How to read three integers from a text-file... ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-04-30 (12:07)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] input_line
> Vaguely related to this, I have some minor gripes about input_line.
> Here's the implementation in 3.04:
> It's obvious that this doesn't handle obnoxiously large newlineless
> inputs very gracefully. Its complexity is quadratic and it's not tail
> recursive.

input_line was reimplemented in the working sources to avoid the
quadratic behavior you mention.

> And worst of all, there are no limits on the size of string
> to be created. So a maliciously designed huge input could blow either
> the stack or the heap. I wouldn't want to use input_line in a network
> application.

I see your point, but there are other (most?) applications where you
really do not want to have any hard limits beyond available memory.

- Xavier Leroy
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: