[Lazarus] Converting all code to use UnicodeString

Marcos Douglas B. Santos md at delfire.net
Mon Sep 25 20:51:25 CEST 2017


I understand use IFDEF to compile in different platforms like Windows
vs... err... Haiku. Of Linux vs Nintendo Wii...
But why should I use IFDEF in a code that should be the same in both
compilers (FPC vs Delphi)?
Is it because the string type is not Unicode? OK, so I want to convert
all to use UTF16, ie, UnicodeString (wrong name) and make ALL code
compatible. But this is looks like not possible without:

* IFDEFs
* know a few {modes}
* know what type of string I'm working on


If there is an argument in the compiler to compile it with the
definition of "all string is an UnicodeString like Java, C#, Delphi
and all them", would be great.
Then we will compile the compiler and Lazarus with the same type of
string and everything will work.
It will be slower than now? Yes, maybe... but we already use objects!
If you want 500% performance, use pointers, records and procedures
with whatever encode you want. But if you use objects, the overhead
already exists... and who cares? 1ms... 2ms... even 2s that you may
lost using UTF16? (or UTF8, but make all equal!) So? The world is
using Ruby and they don't care... or Python, Java... and they store in
UTF16 too, which requires a double of space... but if it works and the
code is clean, should be more important, don't agree?

Best regards,
Marcos Douglas


More information about the Lazarus mailing list