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


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to