Re: [fpc-pascal] Is this behavior related to calling convention?

2013-12-08 Thread Jürgen Hestermann

Am 2013-12-07 19:12, schrieb Jonas Maebe:
 On 07 Dec 2013, at 18:50, Jürgen Hestermann wrote:
 I am wondering what the advantage is to *not* garantee a left to right order.
 
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/ncal.pas?view=markup#l3268


Thanks Jonas.
Interesting what complex things happen behind the scene...
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Is this behavior related to calling convention?

2013-12-07 Thread Xiangrong Fang
I have this function:

function Compare(v1, v2: Integer): Integer;

And called like this:

Result := Compare(stack.Pop, stack.Pop);

The behavior is that the second Pop is evaluated first, thus reversed the
meaning of the function.

Is it true that all parameter evaluation goes from right to left?

Thanks!
Xiangrong
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Is this behavior related to calling convention?

2013-12-07 Thread Jonas Maebe

On 07 Dec 2013, at 09:40, Xiangrong Fang wrote:

 Is it true that all parameter evaluation goes from right to left?

The order in which parameters are evaluated is unrelated to the calling 
convention. This order has always been undefined in FPC, and it is also 
undefined in recent versions of Delphi.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is this behavior related to calling convention?

2013-12-07 Thread Jürgen Hestermann

Am 2013-12-07 10:15, schrieb Jonas Maebe:
 The order in which parameters are evaluated is unrelated to the calling 
convention.
 This order has always been undefined in FPC, and it is also undefined in 
recent versions of Delphi.

I am wondering what the advantage is to *not* garantee a left to right order.
I can't think of a situation where changing this order makes any sense.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is this behavior related to calling convention?

2013-12-07 Thread Marco van de Voort
In our previous episode, J?rgen Hestermann said:
 I am wondering what the advantage is to *not* garantee a left to right order.

Undefined order allows to do the evaluation that needs the most temps first I
guess, which reduces spilling.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is this behavior related to calling convention?

2013-12-07 Thread Jonas Maebe

On 07 Dec 2013, at 18:50, Jürgen Hestermann wrote:

 I am wondering what the advantage is to *not* garantee a left to right order.

http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/ncal.pas?view=markup#l3268


Jonas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal