关于C++(VC2005)编译多一条JMP指令的问题,待解决

时间问题,直接上代码:

void fnLoopDemo()
{
	int i, j, k, l, m, n, x;

	for(i = 0; i < 10; i++)
	{
		j = 1;
		if(j)
		{
			k = 1;
			while(k)
			{
				l = 1;
				if(l)
				{
					for(m = 0; m < 5; m++)
					{
						x = 0;
					}
					for(n = 0; n < 5; n++)
					{
						x = 1;
					}
					x = 100;
					goto _cw;
				}
				x = 200;
_cw:
				__asm{}
			}
_bw:
			__asm{}
		}
	}
}


DASM结果如下:

void fnLoopDemo()
{
00416B00 55               push        ebp  
00416B01 8B EC            mov         ebp,esp 
00416B03 81 EC 14 01 00 00 sub         esp,114h 
00416B09 53               push        ebx  
00416B0A 56               push        esi  
00416B0B 57               push        edi  
00416B0C 8D BD EC FE FF FF lea         edi,[ebp-114h] 
00416B12 B9 45 00 00 00   mov         ecx,45h 
00416B17 B8 CC CC CC CC   mov         eax,0CCCCCCCCh 
00416B1C F3 AB            rep stos    dword ptr es:[edi] 
	int i, j, k, l, m, n, x;

	for(i = 0; i < 10; i++)
00416B1E C7 45 F8 00 00 00 00 mov         dword ptr [i],0 
00416B25 EB 09            jmp         fnLoopDemo+30h (416B30h) 
00416B27 8B 45 F8         mov         eax,dword ptr [i] 
00416B2A 83 C0 01         add         eax,1 
00416B2D 89 45 F8         mov         dword ptr [i],eax 
00416B30 83 7D F8 0A      cmp         dword ptr [i],0Ah 
00416B34 0F 8D 82 00 00 00 jge         _bw+5 (416BBCh) 
	{
		j = 1;
00416B3A C7 45 EC 01 00 00 00 mov         dword ptr [j],1 
		if(j)
00416B41 83 7D EC 00      cmp         dword ptr [j],0 
00416B45 74 70            je          _bw (416BB7h) 
		{
			k = 1;
00416B47 C7 45 E0 01 00 00 00 mov         dword ptr [k],1 
			while(k)
00416B4E 83 7D E0 00      cmp         dword ptr [k],0 
00416B52 74 63            je          _bw (416BB7h) 
			{
				l = 1;
00416B54 C7 45 D4 01 00 00 00 mov         dword ptr [l],1 
				if(l)
00416B5B 83 7D D4 00      cmp         dword ptr [l],0 
00416B5F 74 4D            je          fnLoopDemo+0AEh (416BAEh) 
				{
					for(m = 0; m < 5; m++)
00416B61 C7 45 C8 00 00 00 00 mov         dword ptr [m],0 
00416B68 EB 09            jmp         fnLoopDemo+73h (416B73h) 
00416B6A 8B 45 C8         mov         eax,dword ptr [m] 
00416B6D 83 C0 01         add         eax,1 
00416B70 89 45 C8         mov         dword ptr [m],eax 
00416B73 83 7D C8 05      cmp         dword ptr [m],5 
00416B77 7D 09            jge         fnLoopDemo+82h (416B82h) 
					{
						x = 0;
00416B79 C7 45 B0 00 00 00 00 mov         dword ptr [x],0 
					}
00416B80 EB E8            jmp         fnLoopDemo+6Ah (416B6Ah) 
					for(n = 0; n < 5; n++)
00416B82 C7 45 BC 00 00 00 00 mov         dword ptr [n],0 
00416B89 EB 09            jmp         fnLoopDemo+94h (416B94h) 
00416B8B 8B 45 BC         mov         eax,dword ptr [n] 
00416B8E 83 C0 01         add         eax,1 
00416B91 89 45 BC         mov         dword ptr [n],eax 
00416B94 83 7D BC 05      cmp         dword ptr [n],5 
00416B98 7D 09            jge         fnLoopDemo+0A3h (416BA3h) 
					{
						x = 1;
00416B9A C7 45 B0 01 00 00 00 mov         dword ptr [x],1 
					}
00416BA1 EB E8            jmp         fnLoopDemo+8Bh (416B8Bh) 
					x = 100;
00416BA3 C7 45 B0 64 00 00 00 mov         dword ptr [x],64h 
00416BAA EB 09            jmp         _cw (416BB5h) 
					goto _cw;
00416BAC EB 07            jmp         _cw (416BB5h) 
				}
				x = 200;
00416BAE C7 45 B0 C8 00 00 00 mov         dword ptr [x],0C8h 
_cw:
				__asm{}
			}
00416BB5 EB 97            jmp         fnLoopDemo+4Eh (416B4Eh) 
_bw:
			__asm{}
		}
00416BB7 E9 6B FF FF FF   jmp         fnLoopDemo+27h (416B27h) 
	}
}
00416BBC 5F               pop         edi  
00416BBD 5E               pop         esi  
00416BBE 5B               pop         ebx  
00416BBF 81 C4 14 01 00 00 add         esp,114h 
00416BC5 3B EC            cmp         ebp,esp 
00416BC7 E8 BF A5 FF FF   call        @ILT+390(__RTC_CheckEsp) (41118Bh) 
00416BCC 8B E5            mov         esp,ebp 
00416BCE 5D               pop         ebp  
00416BCF C3               ret              
--- 无源文件 -----------------------------------------------------------------------


在x = 100;这里,多了一条jmp跳转指令,怪哉怪哉!我项目代码多起来以后JMP的地址还不相同,搞得我都不知道是自己逻辑问题还是代码问题

抑或是性别问题,长相问题,人品问题,还是别的什么问题,其实微软很操蛋!

你可能感兴趣的:(关于C++(VC2005)编译多一条JMP指令的问题,待解决)