[fpc-pascal] Managed types within records

Jürgen Hestermann juergen.hestermann at gmx.de
Thu May 28 18:15:48 CEST 2015


Hi,

when I have a record which has managed types (i.e. strings),
how are they handled by the compiler when I assign one record to the other?
Example:

---------------------------------------------------
type MyRecordType = record
                                       X : SizeInt;
                                       S : AnsiString;
                                       end;
var A,B : ^MyRecordType;

begin
new(A);
new(B);
A^.X := 7;
A^.S := 'String in A';
B^ := A^;
Dispose(A);
end;
---------------------------------------------------

What happens to the reference counter of S?
Is it updated correctly (assigned to zero with new,
incremented with B^:=A^ and decremented with dispose)?




More information about the fpc-pascal mailing list