Re: Pascal vs C style string ?

mps@dent.uchicago.edu (Michael Spertus)
Tue, 5 Jul 1994 13:16:50 GMT

          From comp.compilers

Related articles
[14 earlier articles]
Re: Pascal vs C style string ? cjmchale@dsg.cs.tcd.ie (1994-06-29)
Re: Pascal vs C style string ? nandu@cs.clemson.edu (1994-06-29)
Re: Pascal vs C style string ? Theo.Norvell@comlab.oxford.ac.uk (1994-06-30)
Re: Pascal vs C style string ? guerin@IRO.UMontreal.CA (1994-06-30)
Re: Pascal vs C style string ? synaptx!thymus!daveg@uunet.uu.net (Dave Gillespie) (1994-06-30)
Re: Pascal vs C style string ? nickh@harlequin.co.uk (1994-07-01)
Re: Pascal vs C style string ? mps@dent.uchicago.edu (1994-07-05)
| List of all articles for this month |
Newsgroups: comp.compilers
From: mps@dent.uchicago.edu (Michael Spertus)
Keywords: C, Pascal, design, comment
Organization: Dept. of Mathematics
References: 94-06-175 94-06-213
Date: Tue, 5 Jul 1994 13:16:50 GMT

The discussion of how strings should be implemented is endless as long
as it assumes the existance of a unique correct answer. In fact there
are very different uses for strings suggesting different formats. A
language with a good macro processor can generally get strings into
a good format. Further the macro language should have access to whether
the user is optomizing for speed or space.


Some strings are known to contain only ascii data in this case zero
termination is not a bad choice. If it is known that the string will
be rarely used e.g. "Logic error in foobar how did we get here", the
string can profitably be put into a pool and L-Z compressed. Since
this reduces load time and the string may never be uncompressed in
millions of runs this is correct for both speed and space.


For strings known to contain binary data zero termination is buggy.
This suggests a different word for binary and ascii strings. In fact
putting a binary string into an ascii string deserves a warning.


Then there are strings that will be heavily manipulated such as a
macro buffer. A format putting them together out of smaller pieces
may be best.
[With this message, I'm ending the Pascal vs. C string thread. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.