Re: [BLACKBOX] Order of calculating parameters

From: Dr. Markus Bautsch <"Dr.>
Date: Thu, 7 Feb 2013 13:31:25 -0500

--
Content-type: text/plain
Dear all !
 
As far as I know Pascal, Modula-2, Oberon and Component Pascal have been always designed according to the following rule (cf. Dev/Docu/P-S-I) to avoid implementation or platform dependencies:
 
"Component Pascal procedure calls conform to the StdCall calling convention (parameters pushed from right to left, removed by called procedure). If the CCall convention (parameters removed by caller) is needed for some DLL procedures, the corresponding procedure declaration in the interface module must be decorated with the [ccall] system flag."
 
See also http://en.wikipedia.org/wiki/X86_calling_conventions#stdcallRegards
 
Markus
 
 
-----Ursprüngliche Mitteilung----- 
Von: Norayr Chilingarian <norayr{([at]})nowhere.xyAn: BLACKBOX <BLACKBOX{([at]})nowhere.xyVerschickt: Do, 7 Feb 2013 5:55 pm
Betreff: Re: [BLACKBOX] Order of calculating parameters
As far as I understand, left to right order is a conequence of the concept 
that compiler can be one pass. So you just parse once from left to right.
In C the order is right to left because they think it is convenient to 
have the first argument on the top of the stack.
---
sent with alpine
https://spyurk.am/u/norayr
http://norayr.arnet.am/weblog
On Thu, 7 Feb 2013, Josef Templ wrote:
> in more recent languages such as Java or C# the evaluation order of
> operands (incl. parameters) is always defined from left to right. In Oberon, 
> however, as far as I remember, it is left undefined.
> The reason, as you mentioned, is that different platforms
> may have different calling conventions and it leaves a bit more
> freedom for the compiler to do optimizations.
>
> - Josef
>
>
> ----- Original Message ----- From: "Oleg N. Cher" <allot{([at]})nowhere.xy> To: <BLACKBOX{([at]})nowhere.xy> Sent: Thursday, February 07, 2013 4:41 PM
> Subject: [BLACKBOX] Order of calculating parameters
>
>
>>  Dear All,
>>
>>  Is the order of calculating parameters uniquely defined in standard of
>>  Component Pascal (or Oberon/Oberon-2)? I've this situation.
>>
>>  PROCEDURE GetData (): INTEGER;
>>  BEGIN (* The data is taken from array "arr", indexed by var "idx". Order
>>  of taken data is one by one. *)
>>    INC(idx); RETURN arr[idx]
>>  END GetData;
>>
>>  ...
>>    (* Example code: *)
>>    PutTile(GetData(), GetData(), GetData()); (* x, y, tile number *)
>>  ...
>>
>>  If the order always left to right (as, in Turbo Pascal/Delphi, data must
>>  be: x, y, tileNum.
>>  If the order always right to left (just as, in some C compilers) data must
>>  be: tileNum, y, x.
>>
>>  I understand of course, that things depends on used calling convention
>>  model. But standards of Oberons must provide the own independent order, as
>>  I think.
>>
>>
>>  --
>>  Oleg N. Cher
>>  VEDAsoft Oberon Club
>>  http://zx.oberon2.ru
>>
>>
>>  ----
>>  To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
>>  LISTSERV{([at]})nowhere.xy>
>
> ----
> To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to 
> LISTSERV{([at]})nowhere.xy>
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to 
LISTSERV{([at]})nowhere.xy---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy--
Content-type: text/html
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><font color="black" size="2" face="Arial, Helvetica, sans-serif">
<div><font style="background-color: transparent;">Dear all !</font></div>
<div>&nbsp;</div>
<div>As far as I know Pascal, Modula-2, Oberon and Component Pascal have been always&nbsp;designed according to&nbsp;the following rule (cf. Dev/Docu/P-S-I) to avoid implementation or platform dependencies:</div>
<div>&nbsp;</div>
<div><font size="2" face="Arial"><font size="2" face="Arial">
<div>&quot;Component Pascal procedure calls conform to the StdCall calling convention (parameters pushed from right to left, removed by called procedure). <font size="2" face="Arial"><font size="2" face="Arial">If the CCall convention (parameters removed by caller) is needed for some DLL procedures, the corresponding procedure declaration in the interface module must be decorated with the [ccall] system flag.&quot;</font></font></div>
<div><font size="2" face="Arial"><font size="2" face="Arial"></font></font>&nbsp;</div>
<div><font size="2" face="Arial"><font size="2" face="Arial">See also <a href="http://en.wikipedia.org/wiki/X86_calling_conventions#stdcall">http://en.wikipedia.org/wiki/X86_calling_conventions#stdcall</a></font></font></font></font>Regards</div>
</div>
<div>&nbsp;</div>
<div>Markus</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div></div>
<div style="color: black; font-family: arial,helvetica; font-size: 10pt;">-----Ursprüngliche Mitteilung----- <br>
Von: Norayr Chilingarian &lt;norayr{([at]})nowhere.xyAn: BLACKBOX &lt;BLACKBOX{([at]})nowhere.xyVerschickt: Do, 7 Feb 2013 5:55 pm<br>
Betreff: Re: [BLACKBOX] Order of calculating parameters<br>
<br>
<div style="margin: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Verdana, Arial, Sans-Serif; font-size: 12px; background-color: rgb(255, 255, 255);" id="AOLMsgPart_0_48031bd9-ee42-4981-bb92-ca9c47281b9c">
<pre style="font-size: 9pt;"><tt>As far as I understand, left to right order is a conequence of the concept 
that compiler can be one pass. So you just parse once from left to right.
In C the order is right to left because they think it is convenient to 
have the first argument on the top of the stack.
---
sent with alpine
<a href="https://spyurk.am/u/norayr" target="_blank">https://spyurk.am/u/norayr</a>
<a href="http://norayr.arnet.am/weblog" target="_blank">http://norayr.arnet.am/weblog</a>
On Thu, 7 Feb 2013, Josef Templ wrote:
&gt; in more recent languages such as Java or C# the evaluation order of
&gt; operands (incl. parameters) is always defined from left to right. In Oberon, 
&gt; however, as far as I remember, it is left undefined.
&gt; The reason, as you mentioned, is that different platforms
&gt; may have different calling conventions and it leaves a bit more
&gt; freedom for the compiler to do optimizations.
&gt;
&gt; - Josef
&gt;
&gt;
&gt; ----- Original Message ----- From: &quot;Oleg N. Cher&quot; &lt;<a href="mailto:allot{([at]})nowhere.xy&gt; To: &lt;<a href="mailto:BLACKBOX{([at]})nowhere.xy&gt; Sent: Thursday, February 07, 2013 4:41 PM
&gt; Subject: [BLACKBOX] Order of calculating parameters
&gt;
&gt;
&gt;&gt;  Dear All,
&gt;&gt;
&gt;&gt;  Is the order of calculating parameters uniquely defined in standard of
&gt;&gt;  Component Pascal (or Oberon/Oberon-2)? I've this situation.
&gt;&gt;
&gt;&gt;  PROCEDURE GetData (): INTEGER;
&gt;&gt;  BEGIN (* The data is taken from array &quot;arr&quot;, indexed by var &quot;idx&quot;. Order
&gt;&gt;  of taken data is one by one. *)
&gt;&gt;    INC(idx); RETURN arr[idx]
&gt;&gt;  END GetData;
&gt;&gt;
&gt;&gt;  ...
&gt;&gt;    (* Example code: *)
&gt;&gt;    PutTile(GetData(), GetData(), GetData()); (* x, y, tile number *)
&gt;&gt;  ...
&gt;&gt;
&gt;&gt;  If the order always left to right (as, in Turbo Pascal/Delphi, data must
&gt;&gt;  be: x, y, tileNum.
&gt;&gt;  If the order always right to left (just as, in some C compilers) data must
&gt;&gt;  be: tileNum, y, x.
&gt;&gt;
&gt;&gt;  I understand of course, that things depends on used calling convention
&gt;&gt;  model. But standards of Oberons must provide the own independent order, as
&gt;&gt;  I think.
&gt;&gt;
&gt;&gt;
&gt;&gt;  --
&gt;&gt;  Oleg N. Cher
&gt;&gt;  VEDAsoft Oberon Club
&gt;&gt;  <a href="http://zx.oberon2.ru" target="_blank">http://zx.oberon2.ru</a>
&gt;&gt;
&gt;&gt;
&gt;&gt;  ----
&gt;&gt;  To unsubscribe, send a message with body &quot;SIGNOFF BLACKBOX&quot; to
&gt;&gt;  <a href="mailto:LISTSERV{([at]})nowhere.xy&gt;
&gt;
&gt; ----
&gt; To unsubscribe, send a message with body &quot;SIGNOFF BLACKBOX&quot; to 
&gt; <a href="mailto:LISTSERV{([at]})nowhere.xy&gt;
----
To unsubscribe, send a message with body &quot;SIGNOFF BLACKBOX&quot; to 
<a href="mailto:LISTSERV{([at]})nowhere.xy</tt></pre>
</div>
 <!-- end of AOLMsgPart_0_48031bd9-ee42-4981-bb92-ca9c47281b9c -->
</div>
</font>
<p>
----
To unsubscribe, send a message with body &quot;SIGNOFF BLACKBOX&quot; to LISTSERV{([at]})nowhere.xy----
Received on Thu Feb 07 2013 - 19:31:25 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:54 UTC