[fpc-pascal] Generic String Functions

Sven Barth pascaldragon at googlemail.com
Fri Feb 28 16:48:59 CET 2014


Am 28.02.2014 15:24, schrieb Michael Schnell:
> On 02/28/2014 03:08 PM, Sven Barth wrote:
>> It is possible as some mails a few months back have shown. If you 
>> have a function that has a RawByteString return type then you can 
>> assign that to a string of any static encoding even if the dynamic 
>> encoding is not the same (and then static and dynamic encoding of the 
>> string variable will not match, nevertheless the RTL and the compiler 
>> will handle them correctly (at least I hope so ^^).
>
> I don't have any Unicode Delphi so I can't test that and as far as I 
> am informed the implementation of "new Delphi strings" in the fpc RTL 
> is still a moving target.
The string type itself is fully functional as far as I know. There might 
still be a few bugs regarding Delphi compatibility here and then, but 
that's nothing new.
> In many discussions I was told that the Delphi "RAW" type does not 
> provide the features necessary to a fully dynamically encoded String, 
> even though when I first read the online Delphi docs, I had the 
> impression that it should.
> .
There is no special RAW type. There is only AnsiString and the 
RawByteString is merely a AnsiString(CP_NONE).
>> The non-conversion nature of RawByteString has its use. 
> I don't doubt this at all. That is why I don't suggest to modify it's 
> behavior but to introduce yet another String encoding type.
No. I would not introduce yet another string type, but try to merge the 
existing string types instead as they all share at least the 
logic/concept while not the implementation.

Regards,
Sven



More information about the fpc-pascal mailing list