Modifying string length?_(re)

Tue, 29 Apr 1997 14:35:06 +0100 (BST)


On Tue, 29 Apr 1997 12:53:53 +0200 Frank Heckenbach  
wrote:
[...]
>> It would not be too difficult to make "MyStr.length" and "MyStr.String" 
>> accessible "record fields" of strings.  Would it be desireable?
>
>Yes! (At least length; the String part is accessible anyway with s[n].)
>
>>  I am
>> not sure how this fits into the standard ...
> 
>I'm not, either. If it conflicts, it should be disabled with
>"--extended-pascal", I suppose.

 It should be disabled, with "-borlland-pascal" as well.

>> Another thing *is* planned:  A new data type `ShortString' (or
>> `ShortStr'?)  which will be the UCSD/Borland version of Strings.  In many
>> contexts, they are better than Extended Pascal string schemata because
>> they have only 1 byte overhead instead of 8.  (But this will be a lot
>> of work.  Anybody interested to help here???)
> 
>What about another type with a 2 byte length field (2 instead of 8 bytes
>overhead)? 

Will this be BP compatible?

>255 chars max length are sometimes not enough. 

But you can use normal GPC strings for that.

>BTW: I heard
>Delphi has some kind of long strings. Anyone knows what they are?

Only available with 32-bit versions of Delphi. Sort of dynamically 
allocated strings. Delphi does all the background work itself 
(allocating, freeing, sizing, resizing, etc). I think  they can be up 
to 2GB in size. Need to be used with care, because all sorts of 
things can go wrong if you treat them like normal strings.
"Almost" compatible with pChars. You can do something 
like "PChar (MyLongString)" to pass a long string as a parameter 
to a function that requires a pChar parameter. When used as
parameters or function results in a DLL, all programs that use
that DLL must use Delphi's memory manager DLL as well.

Personally, I wouldn't touch them with a barge pole.  I would
rather use a pChar, if that is what I want, or a normal string, if
that is what I want - and I prefer to allocate and free memory
for data structures myself.

Best regards, The Chief 
Dr Abimbola A. Olowofoyeku (The African Chief, and the Great Elephant)
Author of:  Chief's Installer Pro v3.12 for Win16 and Win32.
Homepage:  http://ourworld.compuserve.com/homepages/African_Chief/
E-mail: laa12@cc.keele.ac.uk



The African Chief (laa12@cc.keele.ac.uk)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es