Chinaunix首页 | 论坛 | 博客
  • 博客访问: 77315
  • 博文数量: 25
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 220
  • 用 户 组: 普通用户
  • 注册时间: 2015-02-07 20:35
个人简介

Linux software developer, open source player (maybe).

文章分类

全部博文(25)

文章存档

2016年(1)

2015年(24)

我的朋友

分类: C/C++

2015-12-02 19:04:22

Lippman大师(cfront实现者)的经典之作, 个人感触较深的部分有: virtual的实现(object的内存layout), exception的实现.


{test1}: c++ object model, constructor, destructor, and copy constructor/assignment operator.

    object model when using multiple inheritence, expecially when using virtual member function or virtual inheritence
    (adjustment of impliment this).
     multiple inheritence and using virtual functions, the most derived class will have (N-1) virtual tables.

    pointer to class data member (offset) and pointer to class member function (address or vtbl index).
    
{test2}:
    1) template usage; scope of template declaration and scope of template instantiation.
       template instantiation mechanism.
    
    2) exception handling; catch block should use exception reference type, and if rethrow, a new copy will be delivered:
       catch (A a) { ... throw; // the real parameter will be rethrowed (no matter with form parameter). }
    
    3) RTTI: static_cast casts basetype* to derivedtype* in compile time, but may run into undefined state if infact it is not derivedtype*.
阅读(898) | 评论(0) | 转发(0) |
0

上一篇:Modern C++ Design

下一篇:C++ Core Guiderlines

给主人留下些什么吧!~~