Re: Some confuse about the pass of the arguments by gcc

2012-02-22 Thread James Courtier-Dutton
On 22 February 2012 19:05, James Courtier-Dutton wrote: > On 22 February 2012 13:34, 嘉谟 wrote: >> 2012/2/22 James Courtier-Dutton : >>> The order that function parameters are evaluated is undefined. Therefore it >>> is wise to ensure that no matter what order they are evaluated, the result >>> sh

Re: Some confuse about the pass of the arguments by gcc

2012-02-22 Thread James Courtier-Dutton
On 22 February 2012 13:34, 嘉谟 wrote: > 2012/2/22 James Courtier-Dutton : >> The order that function parameters are evaluated is undefined. Therefore it >> is wise to ensure that no matter what order they are evaluated, the result >> should be the same. It is the ++ that breaks it in this case. Did

Re: Some confuse about the pass of the arguments by gcc

2012-02-22 Thread 嘉谟
2012/2/22 James Courtier-Dutton : > The order that function parameters are evaluated is undefined. Therefore it > is wise to ensure that no matter what order they are evaluated, the result > should be the same. It is the ++ that breaks it in this case. Didn't you get > a compiler warning? Yes you

Re: Some confuse about the pass of the arguments by gcc

2012-02-21 Thread Andrew Haley
On 02/21/2012 03:18 PM, 嘉谟 wrote: > I do a experiments to check how gcc pass the arguments. > here is the code > > #include > int main(int argc , char *argv[]){ > int a=3; > int b=3; > int c=3; > printf("%d %d\n",++a+c,a+c); > printf("%d %d\n",++b,b); >