No, the compiler has leeway to rearrange the order in which function parameters are evaluated for optimization purposes.
asm engine
Started by Sephir, May 05 2006 11:28 AM
83 replies to this topic
#82
Posted 26 May 2006 - 07:20 PM
As a matter of fact Visual C++ 2005 evaluates them from right to left. The most probable reason is that most calling conventions require arguments to be pushed on the stack right to left. And the reason for that is so the arguments are in a logical left to right order on the stack, because the stack 'grows' downward. :surrender
#84
Posted 26 May 2006 - 09:24 PM
karligula said:
Regarding the
int i=0;
function(i++,i++);
thing... isn't the comma a sequence point, meaning that the expressions are evaluated in that sequence... so it should become function(0,1) and leave i=2...?
int i=0;
function(i++,i++);
thing... isn't the comma a sequence point, meaning that the expressions are evaluated in that sequence... so it should become function(0,1) and leave i=2...?
No. While the comma operator is indeed a sequence point, the comma in the function call expression does not behave like the comma operator.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.
-
Currently working on: the 3D engine for Tomb Raider.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












