[fpc-devel] Performance of string handling in trunk

Sven Barth pascaldragon at googlemail.com
Mon Jun 24 20:21:15 CEST 2013


On 24.06.2013 11:36, Michael Schnell wrote:
> On 06/21/2013 07:43 PM, Sven Barth wrote:
>>
>>
>> Just to clear up the names: UnicodeString is *not* the code page aware
>> string type (although they share the "metadata" record). It is a
>> dynamic length 2 byte string. The code page aware string type is
>> AnsiString.
>>
>>
> Thanks for making  this clear.
>
> Could you give us a list of the different  - legacy and to be supported
> - string types we might be seeing including their "official" names to
> make the discussion less ambiguous.

ShortString:
   255 character, non reference counted, system encoding

String[X]:
   same as ShortString with maximum of X characters

AnsiString:
   up to 2^23-1 characters, reference counted, system encoding 
(determined by the code page at compilation time AFAIK)

AnsiString(X):
   same as AnsiString, but with the specified code page (UTF-16 code 
pages are not allowed)

RawByteString:
   basically AnsiString($ffff) (AFAIK); no code page conversions are 
done when a another AnsiString is assigned (UnicodeString is converted 
to currently active code page) and the other way round

UnicodeString:
   up to 2^23-1 characters, reference counted, UTF-16 encoding

WideString
   - on non-Windows: same as UnicodeString
   - on Windows: up to 2^23-1 characters (?), non reference counted (but 
managed by OS), UTF-16 encoding

String:
   - in all modes besides mode delphiunicode or modeswitch 
unicodestrings with H-: ShortString
   - in all modes besides mode delphiunicode or modeswitch 
unicodestrings with H+: AnsiString
   - in mode delphiunicode or modeswitch unicodestrings with H+: 
UnicodeString
   (- don't know whether this is correct: in mode delphiunicode or 
modeswitch unicodestrings with H-: ShortString)

Regards,
Sven



More information about the fpc-devel mailing list