[fpc-devel] RTTI module and "IsManaged" critical problem

Maciej Izak hnb.code at gmail.com
Mon Dec 12 15:53:59 CET 2016


2016-12-12 13:32 GMT+01:00 Maciej Izak <hnb.code at gmail.com>:

> Status of #31102 is unclear. I need clear response about ManagedFldCount
> to decide how to do it - as part of FPC or NewPascal or some mixed way to
> keep compatibility as much as possible (in NewPascal for sure I will
> correct ManagedFldCount, current value of ManagedFldCount and form of
> ManagedFields is unacceptable).


My more complex proposition from point 2. Full backward compatible... Fair
enough, ready for Management Operators + fix for Initialize/FinalizeArray:

=== code begin ===
type
  PPRecInitTable = ^PRecInitTable;
  PRecInitTable = TRecInitTable;
  TRecInitTable = packed record
    Size: Longint;
    Terminator: Pointer;
    ManagedFieldCount: Longint;
    { ManagedFields: array[0..ManagedFieldCount - 1] of TManagedField; }
  end;

  TRecordTypeField = packed record
    Field: TManagedField; // :\ a little redundant info (we have this info
also in TotalFields, but we need to deal with $RTTI EXPLICIT)
    Flags: Byte; // visibility
    Name: ShortString;
  end;

  TTypeData =
...
        { tkRecord }
        property ManagedFldCount: Integer read GetManagedFldCount;
 deprecated 'Use TotalFieldCount'; // return TotalFieldCount
...
     tkRecord: (
        RecSize: Integer;
        RecInitTable: PPRecInitTable; // here is accessible
ManagedFieldCount and ManagedFields
        TotalFieldCount: Integer;
       {TotalFields: array[0..TotalFieldCount - 1] of TManagedField;
        RecFldCnt: Integer; // for $RTTI EXPLICIT ... FIELDS
        RecFields: array[0..RecFldCnt - 1] of TRecordTypeField});
=== code end ===

So merge for PART 2 of Management Operators might be not bad idea:

https://github.com/maciej-izak/freepascal/commit/ea23ca80630fae488990dcd4bc62ddc94b18d304

Now I feel that all of my ideas to solve this are expressed.

-- 
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20161212/7d9ba428/attachment.html>


More information about the fpc-devel mailing list