<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Stacey,<br>
<br>
They broke this in D3.&nbsp; I had to rewrite a lot of my old Borland Pascal
code at that time.&nbsp;&nbsp; Borland also made a statement that the order of
evaluation is not defined in the language and should not be relied on.&nbsp;
It has nothing to do with the calling convention.<br>
<br>
Its a pain only for string manipulation.&nbsp; :-)<br>
<br>
Stacey Verner wrote:
<blockquote
 cite="midF2A917BCAC62FA47AE05530061DC3DF014C63E@porky.int.cjntech.co.nz"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 12 (filtered medium)">
  <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
  </style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
  <div class="Section1">
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">After
an odd bug and a bit of testing I have found that the parameters in
Delphi (tested
6 and 2006) are evaluated very strangely.<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">The
3<sup>rd</sup> parameter is evaluated first followed by 4, 5, 6 etc and
then the
2<sup>nd</sup> and then the 1<sup>st</sup>.<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">This
appears to be because the default calling convention is <b>register</b>
which (from
the documentation) puts up to 3 parameters in registers and the rest on
the
stack. It seems to process the stack ones first from parameters 3
onwards (Why 3?
Shouldn&#8217;t it be 4 if we are putting 3 into registers. Must be only
putting 2 in the registers), and then the first 2 in reverse order into
the registers.
The documentation also says that is supposed to pass the from left to
right,
but it obviously doesn&#8217;t.<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">You
can download an example to see for yourself!<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><a
 href="http://www.verner.co.nz/download/FunctionCall.zip">http://www.verner.co.nz/download/FunctionCall.zip</a><o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">If
you are interested how we found this, we have a simple function that
strips the
first delimited item from a string returning the item and removing it
from the
input string. You can have a string something like:<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">LString
:= &#8216;Stacey,G,Verner&#8217;;<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">and
call:<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">LFirstName
:= Extract(LString, &#8216;,&#8217;);<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">LInitial
:= Extract(LString, &#8216;,&#8217;);<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">LLastName
:= Extract(LString, &#8216;,&#8217;);<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">In
this case if we had a function like:<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">function
FullName(PFirstName, PInitial, PLastName: String): String;<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">and
you call it with:<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">LName
:= FullName(Extract(LString, &#8216;,&#8217;), Extract(LString, &#8216;,&#8217;),
Extract(LString, &#8216;,&#8217;));<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">then
we&#8217;ll get the wrong result.<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"
 lang="EN-US">Stacey</span><o:p></o:p></p>
  <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Stacey
Verner&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Ph:&nbsp;&nbsp; +64-9-4154790<br>
Software Developer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fax:&nbsp;
+64-9-4154791<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DDI:&nbsp; +64-9-4154797<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; Email: </span><span
 style="font-size: 12pt; font-family: &quot;Times New Roman&quot;,&quot;serif&quot;;"><a
 href="BLOCKED::mailto:stacey@cjntech.co.nz"
 title="mailto:stacey@cjntech.co.nz"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">stacey@cjntech.co.nz</span></a><o:p></o:p></span></p>
  <div>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">CJN
Technologies Ltd.</span><span
 style="font-size: 12pt; font-family: &quot;Times New Roman&quot;,&quot;serif&quot;;"><o:p></o:p></span></p>
  </div>
  <p class="MsoNormal"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><ns0:Street><ns0:address>PO
Box 302-278, North</ns0:address></ns0:Street> Harbour, <ns0:City>Auckland</ns0:City>
1330, <ns0:place><ns0:country-region>New Zealand</ns0:country-region></ns0:place><br>
  <ns0:Street><ns0:address>12 Piermark Drive, North</ns0:address></ns0:Street>
Harbour, <ns0:place><ns0:City>Auckland</ns0:City>, <ns0:country-region>New
Zealand</ns0:country-region></ns0:place><br>
Visit our website at </span><span
 style="font-size: 12pt; font-family: &quot;Times New Roman&quot;,&quot;serif&quot;;"><a
 href="BLOCKED::http://www.cjntech.co.nz/"
 title="http://www.cjntech.co.nz/"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">http://www.cjntech.co.nz/</span></a></span><o:p></o:p></p>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Delphi mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</a>
<a class="moz-txt-link-freetext" href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</a>
  </pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<title>Signature</title>
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.2900.2802" name="GENERATOR">
<div align="left">
<div align="left"><strong><font size="2"><font color="#666666"
 face="Verdana">Rohit Gupta</font></font></strong></div>
<div align="left"><strong><font size="2"><font color="#666666"
 face="Verdana">
B.E.&nbsp;Elec.&nbsp;&nbsp;&nbsp;M.E.&nbsp;&nbsp;&nbsp;Mem&nbsp;IEEE&nbsp;&nbsp;&nbsp;
Associate&nbsp;IEE</font></font></strong></div>
<div align="left"><strong><font size="2"><font color="#666666"
 face="Verdana">Technical&nbsp;Manager</font></font></strong></div>
<div align="left"><strong><font color="#666666" face="Verdana" size="2">Computer
Fanatics Limited</font></strong></div>
<div align="left"><strong></strong>&nbsp;</div>
<div align="left"><font color="#666666" face="Verdana" size="2"><strong>Tel</strong>&nbsp;&nbsp;&nbsp;&nbsp;
+64 9 4892280</font></div>
<div align="left"><font color="#666666" face="Verdana" size="2"><strong>Fax</strong>&nbsp;&nbsp;&nbsp;
+64 9 4892290</font></div>
<div align="left"><font color="#666666"><font face="Verdana" size="2"><strong>Email&nbsp;
</strong></font><a href="mailto:rohit@cfl.co.nz"><font color="#0080ff"
 face="Verdana" size="2">rohit@cfl.co.nz</font></a></font><font
 color="#666666"><font face="Verdana" size="2"><strong></strong></font></font></div>
<div align="left"><font color="#666666"><font face="Verdana" size="2"><strong>Web&nbsp;&nbsp;
&nbsp;</strong></font><a href="http://www.cfl.co.nz/"><font color="#0080ff"
 face="Verdana" size="2">www.cfl.co.nz</font></a></font></div>
<div>&nbsp;</div>
<div>
<hr></div>
<div align="left"><span
 style="font-size: 7.5pt; color: rgb(153, 153, 153); font-family: Verdana;"><font
 size="1"><span style="font-size: 10pt; font-family: 'Courier New';"
 lang="EN-NZ"><font color="#000000"><font color="#808080" face="Verdana"
 size="1">This email and any attachments contain information, which is
confidential and may be subject to legal privilege and copyright. If
you are not the intended recipient, you must not use, distribute or
copy this email or attachments. If you have received this in error,
please notify us immediately by return email and then delete this email
and any attachments.</font> <o:p></o:p></font></span></font></span></div>
</div>
</div>
</body>
</html>