[fpc-devel] new strings, rawbyte type, but what about "raw" encoding

Sven Barth pascaldragon at googlemail.com
Tue Oct 11 10:04:41 CEST 2011


Am 11.10.2011 09:44, schrieb Hans-Peter Diettrich:
>> what happens (or is intended to happen), if I cast a string to pchar,
>> before handing it over as param?
>>
>> procedure foo(a: Utf8String);
>> .....
>>
>> var s: string;
>> foo(pchar(s));
>
> This will work only when "string" is UTF-16, since PChar is a pointer to
> Unicode. You can try figure out what copies and conversions the compiler
> may insert, in order to match the given casts and argument types.

You do know that currently PChar is still a PAnsiChar? Also there was no 
final decision whether "mode ObjFPC" will have String defined as 
UnicodeString or not. It only seems to be the case that there will be a 
mode "DelphiUnicode" where this is true (and maybe a modeswitch 
"unicodestrings" like was done for the JVM port).

Regards,
Sven



More information about the fpc-devel mailing list