Re: Internal Representation of Strings

Chris F Clark <cfc@shell01.TheWorld.com>
Sat, 14 Feb 2009 17:09:19 -0500

          From comp.compilers

Related articles
Internal Representation of Strings tony@my.net (Tony) (2009-02-14)
Re: Internal Representation of Strings mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2009-02-14)
Re: Internal Representation of Strings haberg_20080406@math.su.se (Hans Aberg) (2009-02-14)
Re: Internal Representation of Strings DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-02-14)
Re: Internal Representation of Strings marcov@stack.nl (Marco van de Voort) (2009-02-14)
Re: Internal Representation of Strings anton@mips.complang.tuwien.ac.at (2009-02-14)
Re: Internal Representation of Strings cfc@shell01.TheWorld.com (Chris F Clark) (2009-02-14)
Re: Internal Representation of Strings lkrupp@pssw.nospam.com.invalid (Louis Krupp) (2009-02-14)
Re: Internal Representation of Strings cr88192@hotmail.com (cr88192) (2009-02-16)
Re: Internal Representation of Strings tony@my.net (Tony) (2009-02-15)
Re: Internal Representation of Strings DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-02-16)
Re: Internal Representation of Strings bartc@freeuk.com (Bartc) (2009-02-16)
Re: Internal Representation of Strings wclodius@lost-alamos.pet (2009-02-16)
[27 later articles]
| List of all articles for this month |

From: Chris F Clark <cfc@shell01.TheWorld.com>
Newsgroups: comp.compilers
Date: Sat, 14 Feb 2009 17:09:19 -0500
Organization: The World Public Access UNIX, Brookline, MA
References: 09-02-051
Keywords: storage, C
Posted-Date: 15 Feb 2009 18:32:06 EST

"Tony" <tony@my.net> writes:


> What are some good ways/concepts of internal string representation?


One such pointer is this (old but valuable) paper by Paul Abrahams:


http://delivery.acm.org/10.1145/60000/51610/p61-abrahams.pdf?key1=51610&key2=4789464321&coll=GUIDE&dl=GUIDE&CFID=21920990&CFTOKEN=76966469


The idea of having the length at the end of the string (and perhaps
pointing to that end also) has a certain appeal. You can even follow
your length field with a max size field to get a good solution for
mutable strings with lengths (crude monospaced ascii art below).


pointer-------------------V
|unused-space|chars....|0|length|max-size|
.^............^-----------+......|
.+-------------------------------+


There are, of course, more sophisticated representations, such as
"ropes" that may be appropriate.


I'm sure others will have interesting suggestions, and I'm as anxious
to learn them.


Hope this helps,
-Chris


******************************************************************************
Chris Clark Internet: christopher.f.clark@compiler-resources.com
Compiler Resources, Inc. or: compres@world.std.com
23 Bailey Rd Web Site: http://world.std.com/~compres
Berlin, MA 01503 voice: (508) 435-5016
USA fax: (978) 838-0263 (24 hours)


Post a followup to this message

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