[fpc-devel] new string - question on usage
Sven Barth
pascaldragon at googlemail.com
Wed Oct 12 14:28:04 CEST 2011
Am 12.10.2011 14:24, schrieb Michael Schnell:
> On 10/12/2011 02:09 PM, Sven Barth wrote:
>>
>> Basically both, as both rely on and use the fact that "AnsiString[i] =
>> AnsiChar" and "SizeOf(AnsiChar) = 1" and also "UnicodeString[i] =
>> UnicodeChar" and "SizeOf(UnicodeChar) = 2".
> Yep.
>
> But what I wanted to ask is what happens, if I disregard this, e.g using
> the "wrong" String type as a parameter when calling a function or when
> using "SetCodePage" in a "creative" way. What about Type casting ?
There will be a conversion. Like was done before the code page aware
string as well. And then you might experience data loss if you e.g. cast
a UnicodeString with some fancy Unicode characters to an encoding which
doesn't support these characters (same as before).
Regards,
Sven
More information about the fpc-devel
mailing list