[fpc-pascal] TypeInfo question

Sven Barth pascaldragon at googlemail.com
Thu Mar 23 17:16:06 CET 2017


Am 23.03.2017 16:29 schrieb "Ryan Joseph" <ryan at thealchemistguild.com>:
>
> I have some generics which operate on multiple types and instead of
making subclasses for certain types and overriding methods I wonder if
using the RTTI like:
>
> PTypeInfo(TypeInfo(T))^.kind = tkClass
>
> would be a good idea. How is TypeInfo() implemented exactly? I’m curious
if there are any string comparing, allocating memory etc... that would
adversely affect performance since these classes need to perform fast data
lookups/insertions.

TypeInfo() simply inserts the load of a pointer value, so there's not even
a call.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170323/92ec8832/attachment.html>


More information about the fpc-pascal mailing list