> On Jan 16, 2022, at 11:15 PM, Sven Barth <pascaldra...@googlemail.com> wrote:
> 
> The class type already is a unique "ID" for each class type when doing an 
> equal comparison. You can essentially take the address of the VMT as the 
> constant values that the loaded value is compared against.

Does that look something like this then? and if so, this is better then doing 
the if-statement block, like string case statements?

  case PtrUInt(o.ClassType.ClassInfo) of
    PtrUInt(TObject.ClassInfo): writeln('TObject');
  end;

Question then is how you get the VMT address as a constant at compile time.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to