C/C++语言的本质(Directly)

    记得大三实习的时候在一位喜欢做破解的哥们的影响下了解反汇编调试这么一回事儿,于是实践后
恍然悟到:(1)学汇编不为写汇编,而为透析c/c++诸多细节的本质(2)大神的境界应该是每写一句
c/c++语言,其相应汇编代码便了然于心。
    题外话:本文总是把c语言和c++语言写在一起,是因为笔者喜欢,笔者认为如果说汇编语言是机器
语言的第一重映射,那么c语言就是汇编语言的第一重映射、c++是c语言的第1.5重映射。因此要精通
c语言,必然要熟悉汇编,要精通c++必然要精通c语言。
   列举下我通过汇编透析到的的语言本质吧:
   (1)The different of pointer and reference
       int i=0;
       int& j=i;
       int* k=&i;// int* k=&j;
      General explain:reference: alias(the same entity) ; pointer: address(addressof entity)
      In fact, the implement of pointer and reference by assembly is the same. Such as following:
       int i = 5;
       int* pi = &i;
       int ri = i;
     相关的汇编语言代码:

```asm
       mov dword ptr [i], 5
    
       lea eax, [i]
       mov dword ptr[pi], eax;
    
       lea eax, dword ptr[i]
       mov dword ptr[ri], eax

```

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章