[fpc-pascal] AnsiString
Luis Fernando Del Aguila Mejía
luis3000 at ec-red.com
Tue Jan 25 16:13:13 CET 2011
The documentation
(http://www.freepascal.org/docs-html/prog/progsu146.html#x189-1990008.2.7)
says:
-8 Longint current string with size.
-4 Longint with reference count.
But, when I want access to that structure, I have to do it backwards.
-8 Longint with reference count.
-4 Longint current string with size.
{$codepage UTF8}
Var
cad1:AnsiString;
aux1:AnsiString;
p:pointer;
Begin
SetLength(cad1,8);
p:=pointer(cad1);
Writeln('memory address : ',longint(p));
p:=p-4;
Write('memory address : ',longint(p),'=');
//Must show reference count, but shows size
Writeln(longint(p^));
aux1:=cad1;
p:=pointer(cad1);
p:=p-8;
Write('memory address : ',longint(p),'=');
//Must show Size, but shows reference count
Writeln(longint(p^));
End.
Do these positions are different, depending on microprocessor being used ?
Thanks
More information about the fpc-pascal
mailing list