不同阶段学习C++推荐用书(也可以作为对这类图书内容的层次的评价)

http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list

This question attempts to collect the few pearls among the dozens of bad C++ books that are published every year.

Unlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a well-written C++ book. It is way too big and complex for doing this. In fact, it is so big and complex, that there are very many very bad C++ books out there. And we are not talking about bad style, but things like sporting glaringly obvious factual errors and promoting abysmally bad programming styles. And it's even worse with online tutorials. (There is a reason nobody bothered to setup a similar question for online tutorials.)

Please provide quality books and an approximate skill level — preferably after discussing your addition in the C++ chat room. (The regulars might mercilessly undo your work if they disagree with a recommendation.) Add a short blurb/description about each book that you have personally read/benefited from. Feel free to debate quality, headings, etc. Books that meet the criteria will be added to the list. Books that have reviews by the Association of C and C++ Users (ACCU) have links to the review.

To spell it out bluntly: There is no need to add a 75th answer to this question. If you feel like a book should be added, suggest it to the community and let's discuss it.


Note: FAQs and other resources can be found in the C++ tag info and under . There is also a similar post for C:The Definitive C Book Guide and List


Reference Style - All Levels

  1. A Tour of C++ (Bjarne Stroustrup) The "tour" is a quick (about 180 pages and 14 chapters) tutorial overview of all of standard C++ (language and standard library, and using C++11) at a moderately high level for people who already know C++ or at least are experienced programmers. This book is an extended version of the material that constitutes Chapters 2-5 of The C++ Programming Language, 4th edition.

  2. The C++ Programming Language (Bjarne Stroustrup) (updated for C++11) The classic introduction to C++ by its creator. Written to parallel the classic K&R, this indeed reads very much alike it and covers just about everything from the core language to the standard library, to programming paradigms to the language's philosophy. (Thereby making the latest editions break the 1k page barrier.) [Review] The fourth edition (released on May 19, 2013) covers C++11.

  3. C++ Standard Library Tutorial and Reference (Nicolai Josuttis) (updated for C++11Theintroduction and reference for the C++ Standard Library. The second edition (released on April 9, 2012) covers C++11. [Review]

  4. The C++ IO Streams and Locales (Angelika Langer and Klaus Kreft) There's very little to say about this book except that, if you want to know anything about streams and locales, then this is the one place to find definitive answers. [Review]

C++11 References:

  1. The C++ Standard (INCITS/ISO/IEC 14882-2011) This, of course, is the final arbiter of all that is or isn't C++. Be aware, however, that it is intended purely as a reference for experienced users willing to devote considerable time and effort to its understanding. As usual, the first release was quiteexpensive ($300+ US), but it has now been released in electronic form for $30US -- probably the least expensive of the reference books listed here.

  2. Overview of the New C++ (C++11/14) (PDF only) (Scott Meyers) (updated for C++1y/C++14) These are the presentation materials (slides and some lecture notes) of a three-day training course offered by Scott Meyers, who's a highly respected author on C++. Even though the list of items is short, the quality is high.


Beginner

Introductory

If you are new to programming or if you have experience in other languages and are new to C++, these books are highly recommended.

  1. C++ Primer * (Stanley Lippman, Josée Lajoie, and Barbara E. Moo) (updated for C++11) Coming at 1k pages, this is a very thorough introduction into C++ that covers just about everything in the language in a very accessible format and in great detail. The fifth edition (released August 16, 2012) covers C++11. [Review]

  2. Accelerated C++ (Andrew Koenig and Barbara Moo) This basically covers the same ground as theC++ Primer, but does so on a fourth of its space. This is largely because it does not attempt to be an introduction to programming, but an introduction to C++ for people who've previously programmed in some other language. It has a steeper learning curve, but, for those who can cope with this, it is a very compact introduction into the language. (Historically, it broke new ground by being the first beginner's book using a modern approach at teaching the language.) [Review]

  3. Thinking in C++ (Bruce Eckel) Two volumes; second is more about standard library, but still very good

  4. Programming: Principles and Practice Using C++ (Bjarne Stroustrup) An introduction to programming using C++ by the creator of the language. A good read, that assumes no previous programming experience, but is not only for beginners.

* Not to be confused with C++ Primer Plus (Stephen Prata), with a significantly less favorable review.

Best practices

  1. Effective C++ (Scott Meyers) This was written with the aim of being the best second book C++ programmers should read, and it succeeded. Earlier editions were aimed at programmers coming from C, the third edition changes this and targets programmers coming from languages like Java. It presents ~50 easy-to-remember rules of thumb along with their rationale in a very accessible (and enjoyable) style. [Review]

  2. Effective STL (Scott Meyers) This aims to do the same to the part of the standard library coming from the STL what Effective C++ did to the language as a whole: It presents rules of thumb along with their rationale. [Review]


Intermediate

  1. More Effective C++ (Scott Meyers) Even more rules of thumb than Effective C++. Not as important as the ones in the first book, but still good to know.

  2. Exceptional C++ (Herb Sutter) Presented as a set of puzzles, this has one of the best and thorough discussions of the proper resource management and exception safety in C++ through Resource Acquisition is Initialization (RAII) in addition to in-depth coverage of a variety of other topics including the pimpl idiom, name lookup, good class design, and the C++ memory model. [Review]

  3. More Exceptional C++ (Herb Sutter) Covers additional exception safety topics not covered inExceptional C++, in addition to discussion of effective object oriented programming in C++ and correct use of the STL. [Review]

  4. Exceptional C++ Style (Herb Sutter) Discusses generic programming, optimization, and resource management; this book also has an excellent exposition of how to write modular code in C++ by using nonmember functions and the single responsibility principle. [Review]

  5. C++ Coding Standards (Herb Sutter and Andrei Alexandrescu) "Coding standards" here doesn't mean "how many spaces should I indent my code?" This book contains 101 best practices, idioms, and common pitfalls that can help you to write correct, understandable, and efficient C++ code.[Review]

  6. C++ Templates: The Complete Guide (David Vandevoorde and Nicolai M. Josuttis) This is the book about templates as they existed before C++11. It covers everything from the very basics to some of the most advanced template metaprogramming and explains every detail of how templates work (both conceptually and at how they are implemented) and discusses many common pitfalls. Has excellent summaries of the One Definition Rule (ODR) and overload resolution in the appendices.[Review]


Advanced

  1. Modern C++ Design (Andrei Alexandrescu) A groundbreaking book on advanced generic programming techniques. Introduces policy-based design, type lists, and fundamental generic programming idioms then explains how many useful design patterns (including small object allocators, functors, factories, visitors, and multimethods) can be implemented efficiently, modularly, and cleanly using generic programming. [Review]

  2. C++ Template Metaprogramming (David Abrahams and Aleksey Gurtovoy)

  3. C++ Concurrency In Action (Anthony Williams) A book covering C++11 concurrency support including the thread library, the atomics library, the C++ memory model, locks and mutexes, as well as issues of designing and debugging multithreaded applications.

  4. Advanced C++ Metaprogramming (Davide Di Gennaro) A pre-C++11 manual of TMP techniques, focused more on practice than theory. There are a ton of snippets in this book, some of which are made obsolete by typetraits, but the techniques, are nonetheless, useful to know. If you can put up with the quirky formatting/editing, it is easier to read than Alexandrescu, and arguably, more rewarding. For more experienced developers, there is a good chance that you may pick up something about a dark corner of C++ (a quirk) that usually only comes about through extensive experience.


Classics / Older

Note: Some information contained within these books may not be up-to-date or no longer considered best practice.

  1. The Design and Evolution of C++ (Bjarne Stroustrup) If you want to know why the language is the way it is, this book is where you find answers. This covers everything before the standardization of C++.

  2. Ruminations on C++ - (Andrew Koenig and Barbara Moo) [Review]

  3. Advanced C++ Programming Styles and Idioms (James Coplien) A predecessor of the pattern movement, it describes many C++-specific "idioms". It's certainly a very good book and still worth a read if you can spare the time, but quite old and not up-to-date with current C++.

  4. Large Scale C++ Software Design (John Lakos) Lakos explains techniques to manage very big C++ software projects. Certainly a good read, if it only was up to date. It was written long before C++98, and misses on many features (e.g. namespaces) important for large scale projects. If you need to work in a big C++ software project, you might want to read it, although you need to take more than a grain of salt with it. There's been the rumor that Lakos is writing an up-to-date edition of the book for years.

  5. Inside the C++ Object Model (Stanley Lippman) If you want to know how virtual member functions are commonly implemented and how base objects are commonly laid out in memory in a multi-inheritance scenario, and how all this affects performance, this is where you will find thorough discussions of such topics.

This question has historical significance, but is not a good example of an appropriate question. Read and learn from this post, but please do not use it as evidence that you can ask similar questions.

See the FAQ for more information.

share | edit | flag
 
640
 
Please leave this question open. It has been discussed on meta multiple times and the verdict was that, despite this question not fully adhering to current moderation guidelines, it does more good than harm. Also keep in mind that there are — literally! — thousands of links to this question all across the Internet. –   sbi  Aug 21 '12 at 12:55 
1
 
The ISO C++ website from its creator Bjarne Stroustrup's own students has rectified the anomaly cited as the cause for raising this question. –   Chawathe Vipul  Jun 30 '13 at 17:35
 
add / show 6 more comments
 

protected by Robert Harvey Apr 16 '12 at 17:10

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

51 Answers

1 2 next

About C++ Templates The Complete Guide.

I can only say good things about this book. It was written by two top experts and it shows; the examples are well written, explained and placed.

They start by teaching you the basics on a few pages. Then they talk about all the pitfalls and hidden danger there is in template programming and the cool stuff that can be done with them. At the end, they explain in detail the overload resolution and the one definition rule in Appendix A and B.

second edition is scheduled for 2015.

share | edit | flag
 
1
 
Yes my favorite section of this book is the discussion on Policy Based design , which Alexandrescu uses heavily in Modern C++ Design. –   grepsedawk  Dec 23 '08 at 5:54
140
 
This was the book that opened my eyes and made me realise how much I hated C++ –  Brent.Longborough  Jan 4 '09 at 11:54
11
 
I enjoy the part where he discusses future trends. It is fun to see how just about all of these were realized in C++11. It seems that the more unlikely names for the features were chosen. –   emsr  Jun 21 '12 at 19:23
1
 
To help find what you are looking for please help promote Area51 StackExchange Tutorials. –  JabberwockyDecompiler  Aug 19 '13 at 15:37
6
 
There's a 2nd edition in the works, slated for July 2014. –   graham.reeds  Sep 30 '13 at 15:49
 
add comment

I'd add C++ FAQs to the Beginner list. I find it highly readable, enjoyable, and a succinct summary of a lot of material in "The C++ Programming Language" and the "Effective C++" series of books.

share | edit | flag
  add comment
up vote 332 down vote
+50

Large Scale C++ Design, by John Lakos

I'd say intermediate level. In any case. read it before you start/join your very first large project (whichever level you're at).

share | edit | flag
 
15
 
I find the book too verbose and therefore difficult to maintain focus. I would better go for the notes at mpi-inf.mpg.de/~kettner/courses/lib_design_03/notes/large.html –   phaedrus  Apr 10 '09 at 8:05
36
 
I read the book back in 1999, and found it a good read back then. It is worth reading now to get a good feel for "dependency heirarchy." but this is 2010. LSC++D is wayyyy outdated. Written in an era when even a modest C++ program could take 8-10 hours to compile and link. 95% of the issues addressed are obsolete. I have read the drafts for the second book a few years ago. Basically the manuscript was focussed on why every change to C++ in the past 15 years is harmful. Namespaces, exceptions, templates, the STL, none of these pass muster. Hopefully the MS has improved since then. –  Lance Diduck  Apr 26 '10 at 16:42
6
 
The dependency heirarchy part is still highly relevant. We might not need 8-10 hours to compile anymore, but there are still a ton of projects that could benefit from compiling in one minute instead of 15 minutes or more. –   que que  Jun 15 '12 at 18:04
 
add / show 7 more comments

I think Bruce Eckel's Thinking in C++ volumes really stirred me.

http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

http://mindview.net/Books/DownloadSites

share | edit | flag
 
9
 
They are great as introductory books and for the discussions about OOP. But beware that they can't be used as a reference guide - they traded that off to be of the "tutorial" type (well, a great tutorial anyway). –  Blaisorblade  Jan 14 '09 at 23:51
12
 
Hands down the best C++ tutorials ... all other pale in comparison. –   bias  Mar 26 '09 at 22:49
 
add / show 2 more comments

New book by Stroustrup Principles and Practice Using C++ should be a great beginner book.

share | edit | flag
 
7
 
Reading the author's pdf paper on the book on teaching experiences in college it seems like he wants to ensure that his baby (C++) is introduced in the right way to new-comers to C++. Thanks to him for making the effort to set things straight. –   GuruM  Feb 17 '12 at 6:27 
 
add comment

Most of what is important is already there.

I would add Imperfect C++ Practical Solutions for Real-Life Programming By Matthew Wilson.

It is intermediate level, I guess, and has a refreshing approach to it (real-life, is what he said).

share | edit | flag
 
4 upvote
  flag
I read this book when it was new. It's value was debatable even then, but it's very seriously outdated by now, almost a decade later. It refers to compilers from Borland and CodeWarrior, which have mostly disappeared, as well as GCC2.95 and VC6. And it recommends hacking your own stuff into the std lib headers. I am sorry, but that's a -1 from me. –   sbi  Jan 26 '13 at 11:26
 
add comment

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值