[fpc-devel] Performance of string handling in trunk

Marco van de Voort marcov at stack.nl
Tue Jun 25 12:37:36 CEST 2013


In our previous episode, Sven Barth said:
> AnsiString:
>    up to 2^23-1 characters, reference counted, system encoding 
> (determined by the code page at compilation time AFAIK)

(2^31-1 obviously, since it is 32-bit variable, but many operations
use signed types)
 
> 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

(before Win2000, UCS2)
 
> 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)

{$mode delphunicode}{$H-} results in shortstring yes (checked by sizeof)

Note that {$mode delphi} and {$mode delphiunicode} also enable {$H+} while
e.g. mode objfpc doesn't.



More information about the fpc-devel mailing list