<p>Am 03.06.2014 10:26 schrieb "Graeme Geldenhuys" <<a href="mailto:mailinglists@geldenhuys.co.uk">mailinglists@geldenhuys.co.uk</a>>:<br>
><br>
> On 2014-05-31 10:57, Vincent Snijders wrote:<br>
> > I think it is possible to write code without $ifdef (valid for Delphi<br>
> > and FPC) if you use the typeinfo unit to extract the information.<br>
> > <a href="http://www.freepascal.org/docs-html/rtl/typinfo/">http://www.freepascal.org/docs-html/rtl/typinfo/</a><br>
><br>
> Almost, but not quite. Good news is, it is not nearly as bad as Sven<br>
> makes it out to be.<br>
></p>
<p>If one uses a helper function like you did then it's indeed not as bad, but if one doesn't...</p>
<p>> function tiGetTypeInfo(PropInfo: PPropInfo): PTypeInfo;<br>
> begin<br>
> {$IFDEF FPC}<br>
> Result := PropInfo^.PropType;<br>
> {$ELSE}<br>
> Result := PropInfo^.PropType^;<br>
> {$ENDIF}<br>
> end;</p>
<p>Out of curiosity: is this helper declared as "inline"? Would get rid of the call completely in both Delphi and FPC...</p>
<p>><br>
> I've also introduced an enhanced GetPropInfo() with a signature as follows:<br>
><br>
> function tiGetPropInfo(AClass: TClass; PropPath: string; PInstance:<br>
> Pointer): PPropInfo;</p>
<p>Might also profit from a declaration as "inline" :)</p>
<p>Yours,<br>
Sven</p>