Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!almaak.usc.edu!ajayshah From: ajayshah@almaak.usc.edu (Ajay Shah) Newsgroups: comp.lang.pascal Subject: Re: Long strings in TP Message-ID: <30409@usc> Date: 15 Feb 91 20:03:35 GMT References: <1991Feb15.162333.24408@cunixf.cc.columbia.edu> Sender: news@usc Organization: University of Southern California, Los Angeles, CA Lines: 28 Nntp-Posting-Host: almaak.usc.edu In article <1991Feb15.162333.24408@cunixf.cc.columbia.edu> stone@cunixb.cc.columbia.edu (Glenn Stone) writes: >Pardon me if this is a common question, but: > >What's the best way to implement a long string variable, say 600 chars? Option 1: C-like. Use null-terminated strings. Flexible but you lose all strong typing and Pascal compiler protection. Option 2: Pascal-like. Use a word for the length counter. Something like longstring = record length:word data:array[1..600] of char end; Advantage: close to Pascal. Disadvantages: relatively inflexible, could easily be wasteful of memory. -- _______________________________________________________________________________ Ajay Shah, (213)734-3930, ajayshah@usc.edu The more things change, the more they stay insane. _______________________________________________________________________________