0040DEE8 C7 45 FC 01 00 00 00 mov dword ptr [ebp-4],1 i=1
15: int j = ++i + i++ + ++i + ++i + i++;
0040DEEF 8B 45 FC mov eax,dword ptr [ebp-4]
0040DEF2 83 C0 01 add eax,1 //eax=1+1
0040DEF5 89 45 FC mov dword ptr [ebp-4],eax //ebp-4=2
0040DEF8 8B 4D FC mov ecx,dword ptr [ebp-4] //ecx=2
0040DEFB 03 4D FC add ecx,dword ptr [ebp-4] //ecx=2+2=4
0040DEFE 8B 55 FC mov edx,dword ptr [ebp-4] //edx=2
0040DF01 83 C2 01 add edx,1 //edx=2+1=3
0040DF04 89 55 FC mov dword ptr [ebp-4],edx //ebp-4=3
0040DF07 03 4D FC add ecx,dword ptr [ebp-4] //ecx=4+3=7
0040DF0A 8B 45 FC mov eax,dword ptr [ebp-4] //eax=3
0040DF0D 83 C0 01 add eax,1 //eax=3+1=4
0040DF10 89 45 FC mov dword ptr [ebp-4],eax //ebp-4=4
0040DF13 03 4D FC add ecx,dword ptr [ebp-4] //ecx=7+4 =11
0040DF16 03 4D FC add ecx,dword ptr [ebp-4] //ecx=11+4
0040DF19 89 4D F8 mov dword ptr [ebp-8],ecx //ebp-8=15
0040DF1C 8B 4D FC mov ecx,dword ptr [ebp-4]
0040DF1F 83 C1 01 add ecx,1
0040DF22 89 4D FC mov dword ptr [ebp-4],ecx
0040DF25 8B 55 FC mov edx,dword ptr [ebp-4]
0040DF28 83 C2 01 add edx,1
0040DF2B 89 55 FC mov dword ptr [ebp-4],edx
16: printf("j = %d\n",j);
0040DF2E 8B 45 F8 mov eax,dword ptr [ebp-8]
0040DF31 50 push eax
0040DF32 68 1C 30 42 00 push offset string "j = %d\n" (0042301c)
0040DF37 E8 B4 32 FF FF call printf (004011f0)
0040DF3C 83 C4 08 add esp,8
这个是vc6反编译的情况
int i = 1;
002269F8 mov dword ptr [ebp-8],1
int j = ++i + i++ + ++i + ++i + i++;
002269FF mov eax,dword ptr [ebp-8] // eax=1
00226A02 add eax,1 // eax=1+1=2
00226A05 mov dword ptr [ebp-8],eax //ebp-8=2
00226A08 mov ecx,dword ptr [ebp-8] //ecx=2
00226A0B add ecx,1 //ecx=2+1=3
00226A0E mov dword ptr [ebp-8],ecx //ebp-8=3
00226A11 mov edx,dword ptr [ebp-8] //edx=3
00226A14 add edx,1 //edx=3+1=4
00226A17 mov dword ptr [ebp-8],edx //ebp-8=4
00226A1A mov eax,dword ptr [ebp-8] //eax=4
00226A1D add eax,dword ptr [ebp-8] //eax=4+4=8
00226A20 add eax,dword ptr [ebp-8] //eax=8+4=12
00226A23 add eax,dword ptr [ebp-8] //eax=12+4=16
00226A26 add eax,dword ptr [ebp-8] //eax=16+4=20
00226A29 mov dword ptr [ebp-14h],eax // ebp-14=20
00226A2C mov ecx,dword ptr [ebp-8]
00226A2F add ecx,1
00226A32 mov dword ptr [ebp-8],ecx
00226A35 mov edx,dword ptr [ebp-8]
00226A38 add edx,1
00226A3B mov dword ptr [ebp-8],edx
printf("j = %d\n", j);
00226A3E mov eax,dword ptr [ebp-14h]
printf("j = %d\n", j);
00226A41 push eax
00226A42 push 228FF0h
00226A47 call 00221050
00226A4C add esp,8
这个是vs2017反编译的计算结果
综上,我觉得这个是编译器的问题,你问哪个才是结果,我个人觉得vc6是我们理解的那种
|