[fpc-devel] WideString vs UnicodeString / len in char vs byte / *nix vs windows

Michael Van Canneyt michael at freepascal.org
Thu Apr 25 17:37:16 CEST 2019



On Thu, 25 Apr 2019, Sven Barth via fpc-devel wrote:

> Am 25.04.2019 um 15:41 schrieb Martin:
>> Looking at https://bugs.freepascal.org/view.php?id=35359
>> and the latest comments (see end of mail)
>>
>> Is it correct, that "widestring" here has 2 meanings?
>> - the "widestring" that has length in bytes (windows bstr)
>> - "widestring" as a typename / alias
>>
>> And apparently then on *nix, "widestring" is just an alias (to 
>> unicodestring).
>> So using the type with the name of "widestring" on *nix will compile 
>> to a type that has length in chars?
>>
>> At least my test app, seems to imply this.
> Correct. On non-Windows platforms WideString is always an alias to 
> UnicodeString. The distinctive WideString type only exists on Windows 
> platforms as it relies on Windows specific functionality.

This is only about generated debug information, I suppose ?

because the following prints 3 in delphi:

Var
   A : Widestring;

begin
     A:='ABC';
     Writeln(Length(A));
end.

Michael.



More information about the fpc-devel mailing list