Chapter 8. Customizing new and delete
正如C#、JAVA声称自己的内置“垃圾回收能力”一样,C++则以其高效的“手动回收”著称。Scott提到heap资源在多线程编程时的访问问题,引起了我的兴趣。
Item 49 - 52阅读全文>
发表于 @ 2007年06月21日 07:02:00|评论(loading...)|收藏
Chapter 7. Templates and Generic Programming
templates的一个最重要的作用在于让很多原来在运行期的工作提前到编译期间完成。
Item 41:templates和classes一样都是支持interfaces和polymorphics的,而且tempaltes支持implicit interfaces和compile-time polymorphics。
Item 42:typename可以用于标识nested dependent type name,但在base class lists和member initailization list中不可用作base class identifier。
Item 43:模板化基类存在total template specialization情况,有可能导致base classes中的成员函数无法具现,只能通过this->、using declaration或者explicit calling解决。
……
Item 45 - 48阅读全文>
发表于 @ 2007年06月05日 16:08:00|评论(loading...)|收藏
Chapter 7. Templates and Generic Programming
Item 43 - 44阅读全文>
发表于 @ 2007年05月30日 00:39:00|评论(loading...)|收藏
Chapter 7. Templates and Generic Programming
Scott在Item 01里面就列举出了C++中的四种所谓“sublanguages”:C、OO C++、Template C++、STL。前面的Items一直评论的是OO C++,这一章则主要针对Template C++。
Item 41 - 42阅读全文>
发表于 @ 2007年05月28日 00:34:00|评论(loading...)|收藏
Chapter 6. Inheritance and Object-Oriented Design
Item 36 - 37阅读全文>
发表于 @ 2007年05月15日 11:37:00|评论(loading...)|收藏
Chapter 6. Inheritance and Object-Oriented Design
当我辛辛苦苦用virtual functions提供了接口和缺省实现之后,Scott却提出考虑其它解法……
Item 35阅读全文>
发表于 @ 2007年05月12日 01:14:00|评论(loading...)|收藏
Chapter 6. Inheritance and Object-Oriented Design
Item 32 - 34阅读全文>
发表于 @ 2007年05月10日 17:14:00|评论(loading...)|收藏
看完这一章之后,我的一个感觉就是:作为一个程序员,你可以很快地学会一门语言的语法,并写出可以顺利通过编译的程序。但要写出真正优质的代码,不仅仅要掌握语法,还要掌握如何借语言完美地表达需求。唯一的出路在于忘记语法,我现在仅仅是能够理解语法,理解地很僵硬、很教条,还不能忘记语法。
有时想写点感想,觉得会相当力不从心,还是没有深刻体会吧。
Item 29 - 31阅读全文>
发表于 @ 2007年05月10日 00:26:00|评论(loading...)|收藏
Chapter 5. Implementations
如果说对于对象模型的深刻理解是为了更好地设计和声明,那么对于实现的斤斤计较则是为了更高的效率。
Item 26 - 28
阅读全文>
发表于 @ 2007年05月08日 00:40:00|评论(loading...)|收藏
什么样的接口是你应该提供给client的?或者,换句话说:什么样的接口是你希望被提供的?
If an attempted use of an interface won't do what the client expects, the code won't compile; and if the code does compile, it will do what the client wants.
如果你的programs不是写给你自己用,就应该实现上面的要求。
Item 18 - 25
阅读全文>
发表于 @ 2007年05月02日 09:52:00|评论(loading...)|收藏
Chapter 3. Resource Management.
Scott说:这儿的resource包括dynamically allocated memory、file descriptors、mutex locks、GUI objects、database connections和network sockets。
“拿了我的给我还回来,吃了我的给我吐出来”……
Item 13 - 17阅读全文>
发表于 @ 2007年04月23日 00:51:00|评论(loading...)|收藏
第二章 Constructors, Destructors, and Assignment Operators
这一章内容参考Stanley B. Lippman的《Inside the C++ Object Model》也会有不小的收获。
Item07 - 12阅读全文>
发表于 @ 2007年04月19日 15:41:00|评论(loading...)|收藏
因为手头只有Scott的第二版《Effective C++》电子版和第三版纸质印刷版本。本想为了方便,以第二版为模板。仔细看来,二者区别还是不小的,所以还是以第三版为模板。
这是Item 01 - 04阅读全文>
发表于 @ 2007年04月17日 17:49:00|评论(loading...)|收藏