TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: KURT KUZBA
from: DAVID J PORTER
date: 1998-01-27 16:15:00
subject: Pointer to a string

  Kurt Kuzba,
  In a message on 25 January, you wrote to me :
DJ>   Are there any true 'string' libraries available for C?
KK>    You can do this quite easily. The secret to BASIC strings
KK>    is that the strings are handled in a single, preallocated
KK>    memory block which is managed by the support code.
KK>    All the same standard functions are used, and garbage
KK>    collection is performed as needed.
  I thought as much.  The garbage collection could be a major stumbling
  block as I am not exactly up on the play when it comes to them [I've
  only just become comfortable with dynamic allocation without getting
  into any thing too fancy!]
KK>    The drawbacks are obvious, however.
KK>    You have only the specified string space, usually just
KK>    under 64K, to the limit of a standard malloc(), and you
KK>    lose some speed due to your garbage collection.
  But what would the trade-off be WRT speed versus memory fragmentation.  As
  I would understand it, there would be a lot of small malloc/free calls
  which would tend to cause at least a small amount of fragmentation.
KK>    You save some time because you aren't allocating on every
KK>    string initialization, but in the long run, it is easier
KK>    and faster to just use the standard string.h functions.
KK>    Once you learn their use, they are much more powerful and
KK>    not really very difficult to use, compared to BASIC.
  I will probably use these and forget about the single string block, with
  additional functions added to cover those that are missing (or at least
  some wrappers around the more esoteric ones).
KK>    There are MID, LEFT, RIGHT, and other BASIC-like functions
KK>    in the SNIPPETS collection.
  I only have the 10/95 SNIPPETS collection, and it appears that I won't be
  in a position to upgrade to the later ones for some time.  But the versions
  contained in there look suitably robust enough to be useful, although I'll
  admit that I have yet to use them in anger.
KK>    The simple fact is that you just don't find many greyhound
KK>    buses out in 4x4 territory, but they really aren't missed.
  I like it.  I even copied it into my quotes file.
  Cheers,
          DJP  
...
 * ATP/Linux 1.42 * To live in the hearts we leave behind, is not to die.
--- Maximus 3.01
---------------
* Origin: The Farm - Christchurch, NZ, +64-3-385-4750 (3:770/255)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.