在别的游戏里,像我这么帅的,一般都是主角哟~~~
Debug 模式
26: q = (++x) + (++x) + (++x);
0040D785 mov edx,dword ptr [ebp-4]
0040D788 add edx,1
0040D78B mov dword ptr [ebp-4],edx
0040D78E mov eax,dword ptr [ebp-4]
0040D791 add eax,1
0040D794 mov dword ptr [ebp-4],eax
0040D797 mov ecx,dword ptr [ebp-4]
0040D79A add ecx,dword ptr [ebp-4]
0040D79D mov edx,dword ptr [ebp-4]
0040D7A0 add edx,1
0040D7A3 mov dword ptr [ebp-4],edx
0040D7A6 add ecx,dword ptr [ebp-4]
0040D7A9 mov dword ptr [ebp-10h],ecx
解析:x = 10;
1. ++x -> x = 11;
2. ++x -> x = 12;
3. x+x -> 计算前两个x的计算结果 = 24
4. ++x -> x = 13;
5. 所有结果汇总:: 24 + 13 = 37
Release 模式
【最快速度】/【最小大小】
00401000 >push 0A ; /<%d> = A (10.)
00401002 push 00408044 ; |format = "%d",LF,""
00401007 call printf ; \printf
0040100C add esp, 8
0040100F push 5 ; /<%d> = 5
00401011 push 0A ; |<%d> = A (10.)
00401013 push 0D ; |<%d> = D (13.)
00401015 push 27 ; |<%d> = 27 (39.)
00401017 push 19 ; |<%d> = 19 (25.)
00401019 push 00408030 ; |format = "%d, %d, %d, %d, %d",LF,""
0040101E call printf ; \printf
00401023 add esp, 18
00401026 push 5 ; /<%d> = 5
00401028 push 00408044 ; |format = "%d",LF,""
0040102D call printf ; \printf
00401032 add esp, 8
00401035 retn
解析:解析你妹啊!Release版本直接把结果出来了,没有计算过程的好伐?! q是39啊,自己脑补 -_- (提示:先完成三个自增后加运算)
【默认】
26: q = (++x) + (++x) + (++x);
00401053 mov edx,dword ptr [x]
00401056 add edx,1
00401059 mov dword ptr [x],edx
0040105C mov eax,dword ptr [x]
0040105F add eax,1
00401062 mov dword ptr [x],eax
00401065 mov ecx,dword ptr [x]
00401068 add ecx,dword ptr [x]
0040106B mov edx,dword ptr [x]
0040106E add edx,1
00401071 mov dword ptr [x],edx
00401074 add ecx,dword ptr [x]
00401077 mov dword ptr [q],ecx
解析:这个跟Debug模式一样,没有啥优化。
|