两个小问题.
1.i=(j++,k++); 为什么先把没有加一的k赋给i?不是先运算括号里的逗号运算符吗?再把k+1的数赋给i吗?
2.#define CUBE(x) (x*x*x)
在主函数中 x=5; y=CUBE(++x); 是怎样展开(x*x*x)的
6: int x,y; 7: x=5; 00401578 mov dword ptr [ebp-4],5 ;x=5 8: y=CUBE(++x); 0040157F mov eax,dword ptr [ebp-4] ;eax=x //eax=5 x=5 00401582 add eax,1 ;eax=eax+1 //eax=6 00401585 mov dword ptr [ebp-4],eax ;x=eax //x=6 00401588 mov ecx,dword ptr [ebp-4] ;ecx=x //ecx=6 0040158B add ecx,1 ;ecx=ecx+1 //ecx=7 0040158E mov dword ptr [ebp-4],ecx ;x=ecx //x=7 00401591 mov edx,dword ptr [ebp-4] ;edx=x //edx=7 00401594 imul edx,dword ptr [ebp-4] ;edx=edx*x //edx=7*7=49 00401598 mov eax,dword ptr [ebp-4] ;eax=x //eax=7 0040159B add eax,1 ;eax=eax+1 //eax=8 0040159E mov dword ptr [ebp-4],eax ;x=eax //x=8 004015A1 imul edx,dword ptr [ebp-4] ;edx=edx*x // edx=49*8=392 004015A5 mov dword ptr [ebp-8],edx ;y=edx //y=392 9: cout<<y<<endl; 004015A8 push offset @ILT+195(std::endl) (004010c8) 004015AD mov ecx,dword ptr [ebp-8] 004015B0 push ecx 004015B1 mov ecx,offset std::cout (0047be90) 004015B6 call @ILT+250(std::basic_ostream<char,std::char_traits<char> >::operator<<) (004010ff)
004013BA |. C745 FC 05000>mov dword ptr [ebp-4], 5 //x=5 004013C1 |. 8D45 FC lea eax, dword ptr [ebp-4] //eax=&x *eax=5 004013C4 |. FF00 inc dword ptr [eax] //*eax=*eax+1 *eax=6 004013C6 |. 8D45 FC lea eax, dword ptr [ebp-4] //eax=&x *eax=6 004013C9 |. FF00 inc dword ptr [eax] //*eax=*eax+1 *eax=7 004013CB |. 8B45 FC mov eax, dword ptr [ebp-4] //eax=&x *eax=7 004013CE |. 89C2 mov edx, eax //edx=*eax edx=7 004013D0 |. 0FAF55 FC imul edx, dword ptr [ebp-4] //edx=edx*x=7*7=49 004013D4 |. 8D45 FC lea eax, dword ptr [ebp-4] //eax=&x *eax=7 004013D7 |. FF00 inc dword ptr [eax] //*eax=*eax+1 *eax=8 x=8 004013D9 |. 89D0 mov eax, edx //eax=edx eax=49 004013DB |. 0FAF45 FC imul eax, dword ptr [ebp-4] //eax=eax*x eax=49*8=392 004013DF |. 8945 F8 mov dword ptr [ebp-8], eax //y=eax y=392