33 lines
1.3 KiB
Plaintext
33 lines
1.3 KiB
Plaintext
From: siona at chiark.greenend.org.uk (Sion Arrowsmith)
|
|
Date: 10 May 1999 16:54:52 +0100 (BST)
|
|
Subject: An efficient split function
|
|
References: <wy3e15x8sa.fsf@wiggum.dejanews.com>
|
|
Message-ID: <ySy*tbCZn@news.chiark.greenend.org.uk>
|
|
Content-Length: 1035
|
|
X-UID: 1881
|
|
|
|
In article <wy3e15x8sa.fsf at wiggum.dejanews.com>,
|
|
William S. Lear <rael at see.sig> wrote:
|
|
>Previous tests of mine comparing the getline() version that works
|
|
>with C++ strings and that which works with character arrays showed me
|
|
>that the latter was much faster, albeit less flexible.
|
|
|
|
My experience with string v. char* getline() in a real-world log-
|
|
file handler is that the speed up is insignificant compared to the
|
|
processing of the data, and that the char* version has big
|
|
problems unless you can absolutely guarantee a maximum line-
|
|
length on your input. Your code doesn't have the buffer-overrun
|
|
problems the stuff I was cleaning up did, but it is going to lose
|
|
data on lines >1k. (Q. Who'd give you an input line that long? A.
|
|
Never underestimate the perversity of users.)
|
|
|
|
--
|
|
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
|
|
___ | "Frankly I have no feelings towards penguins one way or the other"
|
|
\X/ | -- Arthur C. Clarke
|
|
| If music be the food of love, bring me a doggie bag.
|
|
|
|
|
|
|
|
|