首页 > 编程语言 > 详细

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

时间:2014-09-27 01:40:00      阅读:304      评论:0      收藏:0      [点我收藏+]
    记得大三实习的时候在一位喜欢做破解的哥们的影响下了解反汇编调试这么一回事儿,于是实践后
恍然悟到:(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;
      常人的解释是这样的: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;
     The corresponding assembly code:
       mov dword [i], 5
    
       lea eax, [i]
       mov dword ptr[pi], eax;
    
       lea eax, dword ptr[i]
       mov dword ptr[ri], eax

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

原文:http://blog.csdn.net/xseekerj/article/details/39596099

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!