comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst@cts.com>
Subject: Re: Strings and reading from a file
Date: 1999/05/13
Date: 1999-05-13T20:53:09+00:00	[thread overview]
Message-ID: <yecr9ok4rpn.fsf@king.cts.com> (raw)
In-Reply-To: 373B271F.EA28F9C8@pwfl.com

Marin David Condic <condicma@bogon.pwfl.com> writes:
[...]
> However - enamoured as I am with the "perfect" solution that works for
> any case that may arise - I'd wonder if in practice it isn't a bit of
> overkill. In my experience with text files, most lines are less than the
> 80 character width of a punchcard or glass-teletype. Probably 95% of
> text lines are within twice that number. I can't recall ever seeing a
> text line (in a standard text file like what would be used for some word
> processing app - not a custom data file) which ever exceeded a 256 byte
> string. 

No, it's not overkill.  I commonly work with text files containing
lines hundreds, or even thousands, of characters long.  Most of them
are machine-generated (log files and such).

If you're writing something that will have to deal with arbitrary text
files as input, make sure it will handle arbitrarily long lines.  Even
if you can guarantee (or enforce) that your input lines will never be
longer than some fixed limit, make sure your code fails gracefully if
that limit is exceeded.  Truncation may be acceptable; random
misbehavior is not.

One advantage of Ada is that, even if you don't specifically think to
handle long input lines, you're not likely to step on memory if you
receive unexpected input.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center  <http://www.sdsc.edu>                 <*>
Techno-geek.  Mouse bigger than phone.  Bites heads off virtual chickens.




  reply	other threads:[~1999-05-13  0:00 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-12  0:00 Strings and reading from a file Cameron Hodge
1999-05-11  0:00 ` David Botton
1999-05-12  0:00 ` Robert Dewar
1999-05-12  0:00   ` Cameron Hodge
1999-05-12  0:00     ` David C. Hoos, Sr.
1999-05-12  0:00     ` Marin David Condic
1999-05-12  0:00       ` Tom Moran
1999-05-12  0:00         ` Marin David Condic
1999-05-13  0:00       ` jrcarter001
1999-05-13  0:00         ` dennison
1999-05-13  0:00           ` Martin C. Carlisle
1999-05-13  0:00             ` Marin David Condic
1999-05-13  0:00               ` Keith Thompson [this message]
1999-05-14  0:00                 ` Pascal Obry
1999-05-13  0:00               ` Hyman Rosen
1999-05-13  0:00             ` David Botton
1999-05-13  0:00               ` David Botton
1999-05-14  0:00               ` Jean-Pierre Rosen
1999-05-14  0:00                 ` Keith Thompson
1999-05-14  0:00                   ` David C. Hoos, Sr.
1999-05-14  0:00                     ` Keith Thompson
1999-05-15  0:00                       ` David C. Hoos, Sr.
1999-05-16  0:00                   ` Jean-Pierre Rosen
1999-05-15  0:00             ` jrcarter001
1999-06-05  0:00               ` Matthew Heaney
1999-05-12  0:00   ` dennison
1999-05-12  0:00 ` Gautier
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox