Mail Archives: djgpp/1998/11/20/21:07:05
Gabriel Maffla wrote:
> g(f1(),f2());
> If func g is "stdcall", the program output must be:
> (f1)
> (f2)
>
> But it is not so. What's wrong??
You. :) The C standard says that function arguments can be evaluated
in any order. This is independent of the order in which they are
pushed. So GCC would be well within its rights to do:
call f2
movl %eax, %ebx
call f1
pushl %ebx
pushl %eax
call g
or something similar, if it thought it was more efficient.
If you want to force arguments to be evaluated in a certain order, you
must use temporary variables.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -