BOOK REPORT:Exceptional C++

BOOK NAME:Exceptional C++

AUTHOR:Herb Sutter

Download Site:
http://download.csdn.net/source/1800352

Did you know the "snprinf(...)" that we use in our programs is not part of the C++ standard? Did you know that the "export" keyword has little or no benefit to C++ templates and the source code of the implementation still needs to be shipped? Do you know what primary templates are? Did you know that Accessibility checking is the last things a compiler checks for - after checking for overload resolution? Do you make your virtual functions private? Well, you really should. Do you know what the "const" keyword really buys you? How about inline-ing?

To start, this book is well organized into sections as one would expect such type of organization with book of such type. One differing aspect is with the Case Studies at the end of the book. Mostly around the string class, but nonetheless, they are very informative. The author has taken already-out-there-being-used code and depicts them for their style. Various "guidelines" given by the author in the Case Studies section makes the developer's life a whole lot simpler. One of my favorite guidelines - throughout the book - is the one the author gives about the decision that each developer goes thru when designing a class and wants to make a decision about what to make friend, a member and a non-member of a class:
- Always make it a member if it has to be one.
- Prefer to make it a member if it needs access to internals
- In all other cases, prefer to make it a non-member friend.
Simple? Well, it should be. There are plenty of explanation and example for each of the given guidelines. As one reads and understands the given guidelines, they are very easy memorize-able. Three small phrases which we call have used or even know when we write code, but they are all on paper and are made very simple to be carved in one's memory. The author makes a great deal of effort to follow this routine, an engineering approach to solving problems and designing software, throughout the book. This book is like having an engineering notebook with fun-facts and pointers and hints that you always wanted to know and now you do!

I should really have gone through the book in some sort of a chronological order, but I figured that the Case Studies are rather unique in this book and require special attention.

Who would have thought that there is so much to the Standard Template Libraries? Did you know that there are functions/methods in the STL that one can not even use with the STL? (Item 4) "...the bottom line is that you can't reliably form pointers to standard library member functions and still have portable code." I was blown away by this bold statement. What do you mean? You want to tell me that standard doesn't really constitute a standard? Want to tell me that my code that I have been so carefully writing using the STL might not be portable after all? There are rather amazing twists in the C++ language, and the author elegantly describes these abnormalities, and it the process the author manages to blow your mind away.

A great amount of attention is given throughout the book to the "boost" libraries. I was not familiar with "boost", and I was interested enough after reading this book that I will make a point to read up on it. The author does make a claim that the boost library might become part of the C++ standard, which would explain why the author has referred to the boost library so much in his text. A good deal of attention was also given to Inheritance and Polymorphism as one would expect. The most intriguing part is Item 16 about a class's Private Parts! It explains that Private members are not hidden and how the C++ compiler treats private members and methods.

Virtuality and virtual classes: you know them as the cause of needing to stay at work late to debug your code, and the reason behind male pattern baldness due to the stress that they cause you. If this is the least bit true, then Item 18 is for you. The best quote out of this item is made when the author talks about public virtual functions: "Prefer to make virtual functions private."

A wealth of information is in this book. Herb Sutter has done it. This book is a must for every C++ programmer as it further unleashes the great power and flexibility of the C++ programming language.

 

转载于:https://www.cnblogs.com/caozhu1/archive/2011/05/30/2063015.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值