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.
procedure TStaticArray.PrintValue (value: T); begin case typeKind of tkClass: begin if not IsDefault(value) then TObjectPtr(@value)^.Show else writeln('nil'); end; tkPointer: begin if not IsDefault(value) then writeln(HexStr(PPointer(@value)^)) else writeln('nil'); end; tkRecord: writeln('record'); tkSString: // TODO: crashes. writeln(PString(@value)^); otherwise writeln(PInteger(@value)^); // this is just a hack to print compiler types end; end; Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal