[fpc-pascal]Sring vs AnsiString

Michael Van Canneyt michael.vancanneyt at wisa.be
Thu Nov 16 09:31:47 CET 2000


On Thu, 16 Nov 2000, Mirek Novak wrote:

> What's the difference - sorry for this question here, but I'm unable to
> read PDF under win2000 [CZ]

String is limited to 255 characters.
AnsiString is unlimited length and Reference counted;
  A:=B;
where a and B are ansistrings, will not copy the entire string, but
will simply increase the reference count with 1

The compiler converts between the two transparently.
Declaring a string
 A : String;
will make A a string by default, and if {$H+} is on, A is an ansistring.
 A : Ansistring;
is always an ansistring
 A : String[16];
is always a string, regardless of the  {$H+} setting.

Michael.





More information about the fpc-pascal mailing list