On Sun, 29 Dec 2013, Hans-Peter Diettrich wrote:
Inspired by the current Lazarus discussion I'd like to learn more about the
current state of the implementation of the new AnsiStrings.
In case nothing has be done yet, I'd suggest to extend TAnsiRec by the new
codePage and elemSize fields (words). These can be zero for now, so that the
remaining codebase is not affected. Then it will be possible to play around
with encoded strings, using the codePage field.
All this is done already a long time ago in trunk.
We're way past that stage.
Current stage is the creation of a unicode RTL, where all base file/string
operations accept unicode strings. This is done too.
Next step is creation of the unicode RTL, where "string" = "widestring".
This will be combined with the dotted unit filenames, to be Delphi 2010+
compatible.
To allow people to choose, 2 RTLs will be created: one unicode (string=ansistring),
one non-unicode (string=widestring).
This will result (probably) in 2 paths:
units/os-cpu
units/os-cpu-unicode
This is not decided yet.
I planned the work in februari/march.
A related question:
Why is the string length set to zero in NewAnsiString, when the allocated
Length is already known?
Because the allocated memory length is not necessarily equal to the string
length.
If you have a string of length 50, setting the length to 25 will not discard
and reallocate the memory block, but merely set the character length to 25.
Michael.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel