Am 16.01.2022 um 15:25 schrieb Ryan Joseph via fpc-pascal:

On Jan 16, 2022, at 9:01 PM, Ryan Joseph <generic...@gmail.com> wrote:

  case PtrUInt(o.ClassType) of
    4500656856: writeln('TObject');
  end;
I may have spoken too soon and without thinking the through clearly (it's 
getting late here!). For this to work we would need a unique ID in the RTTI, 
right? I don't think that exists so unless it does we need to do equality 
comparisons for each case.

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.

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

Reply via email to