- 论坛徽章:
- 0
|
本帖最后由 ppm10103 于 2013-05-07 17:58 编辑
- 第一种情况的ASM
- Stock myStock=2;
- 00E01800 sub esp,8
- 00E01803 fld qword ptr [__real@4000000000000000 (0E0A860h)]
- 00E01809 fstp qword ptr [esp]
- 00E0180C lea ecx,[ebp-44h]
- 00E0180F call Stock::Stock (0E0137Fh)
- 00E01814 mov dword ptr [ebp-4],0
- myStock=Stock("a",1.0);
- 00E0181B sub esp,8
- 00E0181E fld1
- 00E01820 fstp qword ptr [esp]
- 00E01823 sub esp,20h
- 00E01826 mov ecx,esp
- 00E01828 mov dword ptr [ebp-128h],esp
- 00E0182E push offset string "a" (0E0A84Ch)
- 00E01833 call std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > (0E0134Dh)
- 00E01838 mov dword ptr [ebp-1A0h],eax
- 00E0183E lea ecx,[ebp-198h]
- 00E01844 call Stock::Stock (0E01262h)
- 00E01849 mov dword ptr [ebp-1A4h],eax
- 00E0184F mov eax,dword ptr [ebp-1A4h]
- 00E01855 mov dword ptr [ebp-1A8h],eax
- 00E0185B mov byte ptr [ebp-4],1
- 00E0185F mov ecx,dword ptr [ebp-1A8h]
- 00E01865 push ecx
- 00E01866 lea ecx,[ebp-44h]
- 00E01869 call Stock::operator= (0E010B4h)
- 00E0186E mov byte ptr [ebp-4],0
- 00E01872 lea ecx,[ebp-198h]
- 00E01878 call Stock::~Stock (0E01046h)
- myStock=Stock("abcde",3.0);
- 00E0187D sub esp,8
- 00E01880 fld qword ptr [__real@4008000000000000 (0E0A840h)]
- 00E01886 fstp qword ptr [esp]
- 00E01889 sub esp,20h
- 00E0188C mov ecx,esp
- 00E0188E mov dword ptr [ebp-11Ch],esp
- 00E01894 push offset string "abcde" (0E0A838h)
- 00E01899 call std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > (0E0134Dh)
- 00E0189E mov dword ptr [ebp-1A0h],eax
- 00E018A4 lea ecx,[ebp-160h]
- 00E018AA call Stock::Stock (0E01262h)
- 00E018AF mov dword ptr [ebp-1A4h],eax
- 00E018B5 mov eax,dword ptr [ebp-1A4h]
- 00E018BB mov dword ptr [ebp-1A8h],eax
- 00E018C1 mov byte ptr [ebp-4],2
- 00E018C5 mov ecx,dword ptr [ebp-1A8h]
- 00E018CB push ecx
- 00E018CC lea ecx,[ebp-44h]
- 00E018CF call Stock::operator= (0E010B4h)
- 00E018D4 mov byte ptr [ebp-4],0
- 00E018D8 lea ecx,[ebp-160h]
- 00E018DE call Stock::~Stock (0E01046h)
- system("pause");
- 00E018E3 mov esi,esp
- 00E018E5 push offset string "pause" (0E0A830h)
- 00E018EA call dword ptr [__imp__system (0E0E450h)]
- 00E018F0 add esp,4
- 00E018F3 cmp esi,esp
- 00E018F5 call @ILT+700(__RTC_CheckEsp) (0E012C1h)
- return 0;
- 第二种情况的ASM
- Stock myStock=Stock("a",1.0);
- 00B81810 sub esp,8
- 00B81813 fld1
- 00B81815 fstp qword ptr [esp]
- 00B81818 sub esp,20h
- 00B8181B mov ecx,esp
- 00B8181D mov dword ptr [ebp-128h],esp
- 00B81823 push offset string "a" (0B8A85Ch)
- 00B81828 call std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > (0B81357h)
- 00B8182D mov dword ptr [ebp-1D8h],eax
- 00B81833 lea ecx,[ebp-1D0h]
- 00B81839 call Stock::Stock (0B81262h)
- 00B8183E mov dword ptr [ebp-1DCh],eax
- 00B81844 mov eax,dword ptr [ebp-1DCh]
- 00B8184A mov dword ptr [ebp-1E0h],eax
- 00B81850 mov dword ptr [ebp-4],0
- 00B81857 mov ecx,dword ptr [ebp-1E0h]
- 00B8185D push ecx
- 00B8185E lea ecx,[ebp-44h]
- 00B81861 call Stock::Stock (0B81307h)
- 00B81866 mov byte ptr [ebp-4],2
- 00B8186A lea ecx,[ebp-1D0h]
- 00B81870 call Stock::~Stock (0B81046h)
- myStock=2;
- 00B81875 sub esp,8
- 00B81878 fld qword ptr [__real@4000000000000000 (0B8A850h)]
- 00B8187E fstp qword ptr [esp]
- 00B81881 lea ecx,[ebp-198h]
- 00B81887 call Stock::Stock (0B81389h)
- 00B8188C mov byte ptr [ebp-4],3
- 00B81890 lea eax,[ebp-198h]
- 00B81896 push eax
- 00B81897 lea ecx,[ebp-44h]
- 00B8189A call Stock::operator= (0B810B4h)
- 00B8189F mov byte ptr [ebp-4],2
- 00B818A3 lea ecx,[ebp-198h]
- 00B818A9 call Stock::~Stock (0B81046h)
- myStock=Stock("abcde",3.0);
- 00B818AE sub esp,8
- 00B818B1 fld qword ptr [__real@4008000000000000 (0B8A840h)]
- 00B818B7 fstp qword ptr [esp]
- 00B818BA sub esp,20h
- 00B818BD mov ecx,esp
- 00B818BF mov dword ptr [ebp-11Ch],esp
- 00B818C5 push offset string "abcde" (0B8A838h)
- 00B818CA call std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > (0B81357h)
- 00B818CF mov dword ptr [ebp-1D8h],eax
- 00B818D5 lea ecx,[ebp-160h]
- 00B818DB call Stock::Stock (0B81262h)
- 00B818E0 mov dword ptr [ebp-1DCh],eax
- 00B818E6 mov eax,dword ptr [ebp-1DCh]
- 00B818EC mov dword ptr [ebp-1E0h],eax
- 00B818F2 mov byte ptr [ebp-4],4
- 00B818F6 mov ecx,dword ptr [ebp-1E0h]
- 00B818FC push ecx
- 00B818FD lea ecx,[ebp-44h]
- 00B81900 call Stock::operator= (0B810B4h)
- 00B81905 mov byte ptr [ebp-4],2
- 00B81909 lea ecx,[ebp-160h]
- 00B8190F call Stock::~Stock (0B81046h)
- system("pause");
- 00B81914 mov esi,esp
- 00B81916 push offset string "pause" (0B8A830h)
- 00B8191B call dword ptr [__imp__system (0B8E450h)]
- 00B81921 add esp,4
- 00B81924 cmp esi,esp
- 00B81926 call @ILT+700(__RTC_CheckEsp) (0B812C1h)
- return 0;
复制代码 ASM代码看出来,第一种情况的2的那个对象的析构函数没被调用,为什么呢?? |
|