[fpc-devel] new string - question on usage
Michael Schnell
mschnell at lumino.de
Wed Oct 12 10:08:41 CEST 2011
On 10/11/2011 09:37 PM, Hans-Peter Diettrich wrote:
> IMO, calling ToLower with a string that is set to the encoding
> "RawByte" does not make sense and should generate an exception.
>
Nope.
A new string consists of a record that contains the encoding ID, element
size, reference count, length and the pointger to the content:
TAnsiRec = Packed Record
CodePage : TSystemCodePage;
ElementSize : Word;
{$ifdef CPU64}
{ align fields }
Dummy : DWord;
{$endif CPU64}
Ref : SizeInt;
Len : SizeInt;
First : AnsiChar;
end;
So each string variable has it's own dedicated encoding ID and can't
point to that of another string.
-Michael
More information about the fpc-devel
mailing list