Skip to content
Tcl Source Code Artifact [667ad23e8c]
Login

Artifact [667ad23e8c]

Artifact 667ad23e8ccd75fd0d9d9f233597e022867bbcbd:

Wiki page [Dynamic Strings] by dgp on 2014-09-11 20:45:38.
D 2014-09-11T20:45:38.086
L Dynamic\sStrings
P 1c143f73e793439fca263b8f20dcb7f5915dec0c
U dgp
W 1322
<h1>Source Files</h1>
  *  portions of [/finfo?name=generic/tclUtil.c|tclUtil.c]

<h1>Public Interface</h1>
  *  struct Tcl_DString
  *  Tcl_DStringInit
  *  Tcl_DStringLength
  *  Tcl_DStringValue
  *  Tcl_DStringAppend
  *  Tcl_DStringAppendElement
  *  Tcl_DStringStartSublist
  *  Tcl_DStringEndSublist
  *  Tcl_DStringSetLength
  *  Tcl_DStringFree

<h1>Private Interface</h1>
  *  TclDStringAppendDString
  *  TclDStringAppendLiteral
  *  TclDStringClear

<h1>Directly Depends On Public Interface</h1>
  *  [Allocation]

<h1>Directly Depends On Private Interface of</h1>
  *  [List Parsing]

<h1>Discussion</h1>

Our good old friend the <b>Tcl_DString</b>!  Taking care of the
housekeeping of resizable arrays as long as we can remember.

Like the [Hash Tables] the foundation is an open struct with some
of the functions implemented as macros, which acts against any kind
of evolution.

The limitation here is that a string may only grow to INT_MAX
bytes in size.  Other problems are that DStrings grow but never
shrink, and their memory waste factor scales linearly with size,
so big strings have big waste.

The simplest path may be to leave these structs unchanged, and
just move away from using them for those tasks where their
limitations are undesirable in Tcl 9.


Z 05748e1d5d4150996b3cbb562839730f