[Lazarus] Making sources compatible with Delphi (but Lazarus is priority)
Marcos Douglas B. Santos
md at delfire.net
Tue May 2 01:30:19 CEST 2017
On Mon, May 1, 2017 at 11:06 AM, Juha Manninen via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:
> On Mon, May 1, 2017 at 12:30 PM, Tony Whyman via Lazarus
> ...
>
> No! The good idea is to use "String".
I agree.
>> 5. Take care when using string literals.
>> I added
>> {$IFDEF FPC}
>> {$codepage UTF8}
>> {$ENDIF}
>
> Yes, string literals are tricky but usually you should NOT use {$codepage UTF8}.
> It is explained in the wiki page. I will not repeat it here.
So, as Mattias said, we should code using ANSI chars and everything will be Ok.
>> 7. Generics
>
> For Delphi compatible generics you can use FPC trunk and the Generics
> Collection lib made by Maciej.
Is it part of FPC? If not, could you can post the official URL?
>> I hope you find this a useful checklist.
>
> It contained so much false information that it only confuses people. :(
>
> I want to repeat that it is possible to write code dealing with
> Unicode that is fully compatible with Delphi at source level.
> It will be compatible with a future UTF-16 solution in Lazarus as well.
> Encoding agnostic (UTF-8 / UTF-16) code is possible even if you must
> iterate individual codepoints. See the wiki page for details.
That is I wanted to read. Thanks.
Some doubts:
> Remember these to keep your code compatible:
> 1. Normally use type "String".
> 1. Assign a constant always to a type String variable.
What do you mean? Instead of create a constant, is it better create a
String variable and assign the string to it?
> 2. Use type UnicodeString explicitly for API calls that need it.
Best regards,
Marcos Douglas
More information about the Lazarus
mailing list