More Effective C++: 35 New Ways to Improve Your Programs and Designs (Addison-Wesley Professional Computing Series) (英語) ペーパーバック – 1995/12/29
Kindle 端末は必要ありません。無料 Kindle アプリのいずれかをダウンロードすると、スマートフォン、タブレットPCで Kindle 本をお読みいただけます。
More than 150,000 copies in print!
Praise for Scott Meyers’ first book, Effective C++:
“I heartily recommend Effective C++ to anyone who aspires to mastery of C++ at the intermediate level or above.”
– The C/C++ User’s Journal
From the author of the indispensable Effective C++, here are 35 new ways to improve your programs and designs. Drawing on years of experience, Meyers explains how to write software that is more effective: more efficient, more robust, more consistent, more portable, and more reusable. In short, how to write C++ software that’s just plain better.
More Effective C++ includes:
- Proven methods for improving program efficiency, including incisive examinations of the time/space costs of C++ language features
- Comprehensive descriptions of advanced techniques used by C++ experts, including placement new, virtual constructors, smart pointers, reference counting, proxy classes, and double-dispatching
- Examples of the profound impact of exception handling on the structure and behavior of C++ classes and functions
- Practical treatments of new language features, including bool, mutable, explicit, namespaces, member templates, the Standard Template Library, and more. If your compilers don’t yet support these features, Meyers shows you how to get the job done without them.
More Effective C++ is filled with pragmatic, down-to-earth advice you’ll use every day. Like Effective C++ before it, More Effective C++ is essential reading for anyone working with C++.
Scott Meyers is one of the world's foremost authorities on C++, providing training and consulting services to clients worldwide. He is the author of the best-selling Effective C++ series of books (Effective C++, More Effective C++, and Effective STL) and of the innovative Effective C++ CD. He is consulting editor for Addison Wesley's Effective Software Development Series and serves on the Advisory Board for The C++ Source (http://www.artima.com/cppsource). He holds a Ph.D. in Computer Science from Brown University. His web site is http://www.aristeia.com.
If you are interested in reading Scott Meyers, I would first read 55 Specific way, along with Modern C++, 40 ways and Effective STL 50 ways. If you want more after reading those three books, then perhaps read this.
The Good: as in his earlier volume, Meyers' writing is easygoing and occasionally funny, e.g. "If BookEntry's constructor throws an exception, pb will be the null pointer, so deleting it in the catch block does nothing except make you feel better about yourself." (Item 10). Despite the overlap with other books noted above (and below), some of the material is both important and not covered elsewhere, especially the stuff on proxy classes and efficiency. In the case of the latter, I really appreciated the table in Item 24 discussing the costs of virtual functions, multiple inheritance, virtual base classes, and RTTI. In a number of places, Meyers elucidates the established terminology of the C++ community. For example, the "return value optimization" you may have heard of amounts to returning constructor arguments instead of objects (Item 20). A notable exception to this terminological clarity is RAII: though he explains the concept, he does not mention the term itself. In typical "tips & tricks" fashion, Meyers presents a large number of useful tidbits of information, a few of which I mention below. Some of these are more or less obvious, but others are less straightforward: a) a sequence of conversions cannot contain more than one user-defined conversion (Item 5), b) postfix increment/decrement operators take an int argument (Item 6), c) passing a temporary object to a non-const reference parameter is not allowed for function calls, but it is for exceptions (Item 12), and d) creating a class template where the type template parameter apparently is never used can help you get separate copies of the static members when the template is instantiated for different types (Item 26).
The Bad: in my opinion, after reading a detailed introductory book the main three things a C++ programmer needs practice with and further instruction on are: a) condensed lore on object-oriented programming, including design idioms and patterns, b) templates, encompassing template metaprogramming, and c) the Standard Template Library, meaning its containers, iterators, and algorithms. (With the coming of the new standard I guess one should add multithreading to this list). The problem is, this book was published in 1996, when all three of these concepts were new(ish) (e.g. Meyers discusses Singleton but he doesn't call it that) so they do not get the treatment they deserve here. Today, Meyers' own "Effective C++, 3rd edition" (2005) does a fine job of discussing templates in more detail as well as introducing a few design patterns. Even more information on these subjects, broken down into bite-sized chunks, can be found in Steve Dewhurst's "C++ Common Knowledge" (2005) and Herb Sutter's "Exceptional C++" (2000). Finally, Meyers' own "Effective STL" contains advice on the STL that is considerably broader and more detailed than what is included in the present tome. The book's time-dependence is obvious in other ways, too, ranging from trivial matters (e.g. in Item 28 the two classes derived from MusicProduct are CD and... Cassette), to topics that are now irrelevant at best (e.g. what to do if your compiler doesn't support new-style casts or the explicit keyword), and even including fundamental issues (e.g. so much attention to auto_ptr seems misplaced today, when we have access to things like shared_ptr and unique_ptr). Finally, in contradistinction to "Effective C++", most Items in "More Effective C++" do not end with a "Summary" section. Given that they are also longer, this interferes with the reader's ability to quickly bring to mind each Item's lessons.
In a nutshell, I believe that this book is no longer the best "third book" on C++ (the first one being a solid introduction like the "C++ Primer" and the second one being none other than "Effective C++, 3rd edition"). It looks like the niche that this book filled when it came out has been taken over by more recent volumes, including Meyers' other works. With C++0x on the horizon and the barrage of new editions about to appear, this will only become more so. However, Meyers' writing is very good and his advice is authoritative, so I definitely did not regret reading this volume.
The book covers a lot of OOP (object oriented programming) concepts and designs, and also a lot of the trouble you can get into using C++ without fully understanding what you are doing. Some of the coverage includes how to use abstract base classes and virtual functions. Specifically Meyers talks about memory management issues with construction and destruction, temporary objects, passing by value versus pointer/reference, and overloading copy/assignment constructors. He also discusses problems with using exceptions, explains how to write a smart pointer class (which is now obsolete with C++11, but still good to understand the implementation), using proxy objects, how to do lazy evaluation, and some various odds and ends.
Overall I found this to be a great text and very helpful, especially the discussion on inheritance and abstract base classes. If you really want to understand C++, warts and all, this should be a required text. However, please read the original title first, as it covers some more fundamental concepts than in the second text. Recommended.
Just a warning. The book is by no means a waste of time, but perhaps your time is better spent finding another resource, providing you already read Effective C++.