Jump to content


asm engine


83 replies to this topic

#81 monjardin

    Senior Member

  • Members
  • PipPipPipPip
  • 1033 posts

Posted 26 May 2006 - 06:49 PM

No, the compiler has leeway to rearrange the order in which function parameters are evaluated for optimization purposes.
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*

#82 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1227 posts
  • LocationOttawa, Ontario, Canada

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

#83 monjardin

    Senior Member

  • Members
  • PipPipPipPip
  • 1033 posts

Posted 26 May 2006 - 08:24 PM

It also allows functions like sprintf to work since the first argument is always on top of the stack.
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*

#84 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

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...?

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users