[fpc-devel] What's the state of "string"?

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Wed Mar 21 09:03:53 CET 2012

On Wed, 21 Mar 2012, Hans-Peter Diettrich wrote:

> I wonder about much code in the RTL/FCL, that depends on String type 
> arguments, like:
>  Procedure TStream.WriteAnsiString (const S : String);
>  Var L : Longint;
>  begin
>    L:=Length(S);
>    WriteBuffer (L,SizeOf(L));
>    WriteBuffer (Pointer(S)^,L);
>  end;
> This method will work only as long as String=AnsiString, because Length 
> *bytes* are written, not *chars* of a possibly different byte count.
> Is the use of generic types, like String, really okay in the library code, 
> when the concrete type matters?

No. This work still needs to be done.

> The documentation on strings (3.2 Character types) is not really helpful, 
> most entries look like they deserve an update reflecting the role of 
> UnicodeString and the generic String type, and implicit string conversions. 
> In detail I miss instructions on how to determine or specify the String type, 
> with different FPC versions.

{$H} is documented, {$IFOPT} is documented.

That's all there is.

As soon as the rest is implemented, it will be documented as well.


More information about the fpc-devel mailing list