Arguably it&#39;s an optimisation.  This isn&#39;t code that is likely to change and incurring an additional function call for such a small snippet of code for the kind of processing such checks might be involved in could be a significant overhead.<div>
<br></div><div>They could have &quot;inline&quot;d it I guess, but there are all sorts of things that seem to break inlining in Delphi (as in &quot;cause to be rejected by the compiler&quot;) and this might fall foul of those.</div>
<div><br></div><div>Another explanation (perhaps also optimisation related) might lie in the fact that it isn&#39;t a perfect duplication... note the slight differences in the call that the first makes to INTERNALGetUnicodeCategory(UCS4Char), whilst the second uses GetUnicodeCategory(String, Index).  Then again, this might also be a sub-optimal variation.  Hard to say without probing deeper than is warranted at this point.<br>
<br>:)</div><div><br><div class="gmail_quote">On 3 June 2012 12:15, Todd <span dir="ltr">&lt;<a href="mailto:todd.martin.nz@gmail.com" target="_blank">todd.martin.nz@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is this a representative example of the code quality Embarcadero is<br>
producing today?<br>
<br>
class function TCharacter.IsNumber(C: Char): Boolean;<br>
begin<br>
  if not IsLatin1(C) then<br>
    Result := CheckNumber(InternalGetUnicodeCategory(UCS4Char(C)))<br>
  else if not IsAscii(C) then<br>
    Result := CheckNumber(InternalGetLatin1Category(C))<br>
  else<br>
    Result := (C &gt;= &#39;0&#39;) and (C &lt;= &#39;9&#39;);<br>
end;<br>
<br>
class function TCharacter.IsNumber(const S: string; Index: Integer):<br>
Boolean;<br>
var<br>
  C: Char;<br>
begin<br>
  CheckStringRange(S, Index);<br>
  C := S[Index];<br>
  if not IsLatin1(C) then<br>
    Result := CheckNumber(GetUnicodeCategory(S, Index))<br>
  else if not IsAscii(C) then<br>
    Result := CheckNumber(InternalGetLatin1Category(C))<br>
  else<br>
    Result := (C &gt;= &#39;0&#39;) and (C &lt;= &#39;9&#39;);<br>
end;<br>
<br>
Todd.<br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br>
</blockquote></div><br></div>