Re: [BLACKBOX] Order of calculating parameters

From: [at]} <Norayr>
Date: Thu, 7 Feb 2013 20:56:38 +0400

----boundary-LibPST-iamunique-819515399_-_-
Content-type: text/plain

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----boundary-LibPST-iamunique-819515399_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGZiaWRpcyBcZGVmZjB7XGZvbnR0YmwN
CntcZjBcZnN3aXNzIEFyaWFsO30NCntcZjFcZm1vZGVybiBDb3VyaWVyIE5ldzt9DQp7XGYyXGZu
aWxcZmNoYXJzZXQyIFN5bWJvbDt9DQp7XGYzXGZtb2Rlcm5cZmNoYXJzZXQwIENvdXJpZXIgTmV3
O319DQp7XGNvbG9ydGJsXHJlZDBcZ3JlZW4wXGJsdWUwO1xyZWQwXGdyZWVuMFxibHVlMjU1O30N
Clx1YzFccGFyZFxwbGFpblxkZWZ0YWIzNjAgXGYwXGZzMjAgQXMgZmFyIGFzIEkgdW5kZXJzdGFu
ZCwgbGVmdCB0byByaWdodCBvcmRlciBpcyBhIGNvbmVxdWVuY2Ugb2YgdGhlIGNvbmNlcHQgXHBh
cg0KdGhhdCBjb21waWxlciBjYW4gYmUgb25lIHBhc3MuIFNvIHlvdSBqdXN0IHBhcnNlIG9uY2Ug
ZnJvbSBsZWZ0IHRvIHJpZ2h0LlxwYXINCkluIEMgdGhlIG9yZGVyIGlzIHJpZ2h0IHRvIGxlZnQg
YmVjYXVzZSB0aGV5IHRoaW5rIGl0IGlzIGNvbnZlbmllbnQgdG8gXHBhcg0KaGF2ZSB0aGUgZmly
c3QgYXJndW1lbnQgb24gdGhlIHRvcCBvZiB0aGUgc3RhY2suXHBhcg0KXHBhcg0KLS0tXHBhcg0K
c2VudCB3aXRoIGFscGluZVxwYXINCmh0dHBzOi8vc3B5dXJrLmFtL3Uvbm9yYXlyXHBhcg0KaHR0
cDovL25vcmF5ci5hcm5ldC5hbS93ZWJsb2dccGFyDQpccGFyDQpPbiB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hbGxpbmcgY29udmVudGlvblxwYXINCj4+ICBtb2RlbC4gQnV0IHN0YW5kYXJk
cyBvZiBPYmVyb25zIG11c3QgcHJvdmlkZSB0aGUgb3duIGluZGVwZW5kZW50IG9yZGVyLCBhc1xw
YXINCj4+ICBJIHRoaW5rLlxwYXINCj4+XHBhcg0KPj5ccGFyDQo+PiAgLS1ccGFyDQo+PiAgT2xl
ZyBOLiBDaGVyXHBhcg0KPj4gIFZFREFzb2Z0IE9iZXJvbiBDbHViXHBhcg0KPj4gIGh0dHA6Ly96
eC5vYmVyb24yLnJ1XHBhcg0KPj5ccGFyDQo+PlxwYXINCj4+ICAtLS0tXHBhcg0KPj4gIFRvIHVu
c3Vic2NyaWJlLCBzZW5kIGEgbWVzc2FnZSB3aXRoIGJvZHkgIlNJR05PRkYgQkxBQ0tCT1giIHRv
XHBhcg0KPj4gIExJU1RTRVJWQExJU1RTLk9CRVJPTi5DSFxwYXINCj5ccGFyDQo+XHBhcg0KPiAt
LS0tXHBhcg0KPiBUbyB1bnN1YnNjcmliZSwgc2VuZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdO
T0ZGIEJMQUNLQk9YIiB0byBccGFyDQo+IExJU1RTRVJWQExJU1RTLk9CRVJPTi5DSFxwYXINCj5c
cGFyDQpccGFyDQpccGFyDQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdl
IHdpdGggYm9keSAiU0lHTk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0J9fQAtRXhj
aGFuZ2UtTw==
----boundary-LibPST-iamunique-819515399_-_---
Received on Thu Feb 07 2013 - 17:56:38 UTC

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