程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> 從匯編看c++中指向成員變量的指針(二)

從匯編看c++中指向成員變量的指針(二)

編輯:C++入門知識

#include <iostream><cstdio>
  Left :   Right :   Bottom :  Left, * bp = &* tp =* lp =* rp =
   Top::*tmp1 = &
   Left::*lmp1 = & Left::*lmp2 = &
   Right::*rmp1 = & Right::*rmp2 = &
   Bottom::*bmp1 = & Bottom::*bmp2 = & Bottom::*bmp3 = & Bottom::*bmp4 = &
  cout <<  <<<<  << (tmp1) <<<<  << (lmp1) <<<<  << (lmp2) <<<<  << (rmp1) <<<<  << (rmp2) <<<<  << (bmp1) <<<<  << (bmp2) <<<<  << (bmp3) <<<<  << (bmp4) <<
  cout <<  <<, &<<, &, &<<, &, &<<, &, &, &, &->*bmp1 = ->*bmp2 = ->*bmp3 = ->*bmp4 = ===

下面是程序運行的結果:


        DWORD PTR $T24720[ebp], 
        DWORD PTR $T24720[ebp+], 
        ecx, DWORD PTR $T24720[ebp]
        DWORD PTR _bmp1$[ebp], ecx
        edx, DWORD PTR $T24720[ebp+]
        DWORD PTR _bmp1$[ebp+], edx


    

        DWORD PTR $T24721[ebp], 
        DWORD PTR $T24721[ebp+], 
        ecx, DWORD PTR $T24721[ebp+    DWORD PTR _bmp2$[ebp+
    
        edx, edx
        edx, -
        SHORT $LN9@main
        DWORD PTR $T24722[ebp], 
        DWORD PTR $T24722[ebp+], -
        ecx, DWORD PTR $T24722[ebp+    DWORD PTR $T24726[ebp+
        edx, edx
        SHORT $LN7@main
        DWORD PTR tv89[ebp], 
        SHORT $LN8@main
$
        DWORD PTR tv89[ebp], 
        eax, DWORD PTR tv89[ebp]
        eax, 
        DWORD PTR $T24723[ebp], eax
        DWORD PTR $T24723[ebp+], 
        ecx, DWORD PTR $T24723[ebp]
        DWORD PTR $T24726[ebp], ecx
        edx, DWORD PTR $T24723[ebp+]
        DWORD PTR $T24726[ebp+], edx
$
        eax, DWORD PTR $T24726[ebp]
        DWORD PTR _bmp3$[ebp], eax
        ecx, DWORD PTR $T24726[ebp+]
        DWORD PTR _bmp3$[ebp+], ecx


    

        DWORD PTR $T24729[ebp],         
        DWORD PTR $T24729[ebp+], 
        eax, DWORD PTR $T24729[ebp+    DWORD PTR _bmp4$[ebp+], eax

        

   :   bp->*bmp1 = 
        ecx, DWORD PTR _bp$[ebp]
        edx, DWORD PTR [ecx]
        eax, DWORD PTR _bmp1$[ebp+]
        ecx, DWORD PTR _bp$[ebp]
        ecx, DWORD PTR [edx+eax]
                                
                                
                                
                                
        edx, DWORD PTR _bmp1$[ebp]
        DWORD PTR [ecx+edx], 
                              



        eax, DWORD PTR _bp$[ebp]
        ecx, DWORD PTR [eax]
        edx, DWORD PTR _bmp2$[ebp+]
        eax, DWORD PTR _bp$[ebp]
        eax, DWORD PTR [ecx+edx]
                                
                                
                                
        ecx, DWORD PTR _bmp2$[ebp]
        DWORD PTR [eax+ecx], 
                              


    

        ecx, DWORD PTR _bmp3$[ebp+    DWORD PTR [edx+eax], 


      

        eax, DWORD PTR _bmp4$[ebp+    DWORD PTR [ecx+edx], 

     

  

 

     

 成員變量指針之間的轉換

   :   bmp1 = tmp1
        DWORD PTR _tmp1$[ebp], -
        SHORT $LN11@main
        DWORD PTR $T24736[ebp], 
        DWORD PTR $T24736[ebp+], -
        eax, DWORD PTR $T24736[ebp]
        DWORD PTR $T24738[ebp], eax
        ecx, DWORD PTR $T24736[ebp+]
        DWORD PTR $T24738[ebp+], ecx
        SHORT $LN12@main
$
        edx, DWORD PTR _tmp1$[ebp]
        DWORD PTR $T24737[ebp], edx
        DWORD PTR $T24737[ebp+], 
        eax, DWORD PTR $T24737[ebp]
        DWORD PTR $T24738[ebp], eax
        ecx, DWORD PTR $T24737[ebp+]
        DWORD PTR $T24738[ebp+], ecx
$
        edx, DWORD PTR $T24738[ebp]
        DWORD PTR _bmp1$[ebp], edx
        eax, DWORD PTR $T24738[ebp+]
        DWORD PTR _bmp1$[ebp+], eax



        ecx, DWORD PTR _lmp2$[ebp]
        DWORD PTR _bmp2$[ebp], ecx
        edx, DWORD PTR _lmp2$[ebp+]
        DWORD PTR _bmp2$[ebp+], edx



        DWORD PTR _rmp2$[ebp+], -
        SHORT $LN13@main
        DWORD PTR $T24741[ebp], 
        DWORD PTR $T24741[ebp+], -
        eax, DWORD PTR $T24741[ebp]
        DWORD PTR $T24743[ebp], eax
        ecx, DWORD PTR $T24741[ebp+]
        DWORD PTR $T24743[ebp+], ecx
        SHORT $LN14@main
$
        edx, DWORD PTR _rmp2$[ebp+]
        edx
        edx, edx
        edx, -                    
        edx, 
        edx, DWORD PTR _rmp2$[ebp]
        DWORD PTR $T24742[ebp], edx
        eax, DWORD PTR _rmp2$[ebp+]
        DWORD PTR $T24742[ebp+], eax
        ecx, DWORD PTR $T24742[ebp]
        DWORD PTR $T24743[ebp], ecx
        edx, DWORD PTR $T24742[ebp+]
        DWORD PTR $T24743[ebp+], edx
$
        eax, DWORD PTR $T24743[ebp]
        DWORD PTR _bmp3$[ebp], eax
        ecx, DWORD PTR $T24743[ebp+]
        DWORD PTR _bmp3$[ebp+], ecx

    edx, DWORD PTR _rmp2$[ebp+]
        edx
        edx, edx
        edx, -                    
        edx, 
        edx, DWORD PTR _rmp2$[ebp]

 

            

 

 

 

 

 

 

 

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved