Am 19.10.2017 07:45 schrieb "Ryan Joseph" <r...@thealchemistguild.com>:
>
> How should you print types in generics for debugging? here’s an example
of how I’m doing it now but it’s hacky (forced type casting pointers) and
tkSString crashes like it is. There should be a better solution I think.

There isn't really a better solution, except that you could move that code
to a separate class or record so that you can use it in other
classes/record than TStaticArray as well...
And your case for tkSString crashes, because that is a ShortString, not a
AnsiString thus you need to cast to PShortString (best avoid "(P)String" in
this context as this could lead to different results depending on the
modeswitches). For the other string types you need to look at tkAString
(AnsiString), tkWString (WideString) and tkUString (UnicodeString).

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

Reply via email to