- 论坛徽章:
- 0
|
强烈建议:加上括号,不然很容易出错的
先把所有的都用字符串替换先进行:
int i = 3, j, k;
j = i++ * i++;
k = ++i * ++i;
i = 3;
j = i++ * i++; + i++;
k = ++i * ++i + ++i;
然后个人认为进行反汇编是最好理解的:
j = i++ * i++;
00401033 mov eax,dword ptr [ i]
00401036 imul eax,dword ptr [ i]
0040103A mov dword ptr [j],eax
0040103D mov ecx,dword ptr [ i]
00401040 add ecx,1
00401043 mov dword ptr [ i],ecx
00401046 mov edx,dword ptr [ i]
00401049 add edx,1
0040104C mov dword ptr [ i],edx
k = ++i * ++i;
0040104F mov eax,dword ptr [ i]
00401052 add eax,1
00401055 mov dword ptr [ i],eax
00401058 mov ecx,dword ptr [ i]
0040105B add ecx,1
0040105E mov dword ptr [ i],ecx
00401061 mov edx,dword ptr [ i]
00401064 imul edx,dword ptr [ i]
00401068 mov dword ptr [k],edx
j = i++ * i++; + i++;
00401091 mov edx,dword ptr [ i]
00401094 imul edx,dword ptr [ i]
00401098 mov dword ptr [j],edx
0040109B mov eax,dword ptr [ i]
0040109E add eax,1
004010A1 mov dword ptr [ i],eax
004010A4 mov ecx,dword ptr [ i]
004010A7 add ecx,1
004010AA mov dword ptr [ i],ecx
004010AD mov edx,dword ptr [ i]
004010B0 add edx,1
004010B3 mov dword ptr [ i],edx
k = ++i * ++i + ++i;
004010B6 mov eax,dword ptr [ i]
004010B9 add eax,1
004010BC mov dword ptr [ i],eax
004010BF mov ecx,dword ptr [ i]
004010C2 add ecx,1
004010C5 mov dword ptr [ i],ecx
004010C8 mov edx,dword ptr [ i]
004010CB add edx,1
004010CE mov dword ptr [ i],edx
004010D1 mov eax,dword ptr [ i]
004010D4 imul eax,dword ptr [ i]
004010D8 add eax,dword ptr [ i]
004010DB mov dword ptr [k],eax
晕啊[ i]不带空格还显示不出来
[ 本帖最后由 daybreakcx 于 2009-5-5 15:10 编辑 ] |
|