这个问题试图收集每年出版的几十本糟糕的C++书籍中的几颗珍珠。
与许多其他编程语言不同,这些语言经常从网上的教程中学习,很少有人能够在不学习一本编写良好的C++书的情况下快速学习C++。这样做太大太复杂了。事实上,它是如此庞大和复杂,以至于有很多非常糟糕的C++书籍。我们谈论的并不是糟糕的风格,而是一些明显的事实错误和糟糕透顶的编程风格。
请编辑已接受的答案,以提供高质量的书籍和大致的技能水平-最好在C++聊天室讨论您的添加后。(如果常客不同意你的建议,他们可能会无情地撤销你的工作。)添加一个简短的简介/描述,介绍你个人阅读过/受益过的每本书。欢迎讨论质量、标题等。符合标准的书籍将被添加到列表中。有C和C++用户协会(ACCU)评论的书籍都有评论链接。
*注意:常见问题解答和其他资源可以在C++标记信息和C++-faq下找到。
新手
入门级,没有编程经验
Book |
Author(s) |
Description |
review |
C++ Primer*
* Not to be confused with C++ Primer Plus (Stephen Prata), with a significantly less favorable review. |
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] |
Programming: Principles and Practice Using C++ |
Bjarne Stroustrup, 2nd Edition - May 25, 2014 (updated for C++11/C++14) |
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. |
|
入门级,具有以前的编程经验
Book |
Author(s) |
Description |
review |
A Tour of C++ |
Bjarne Stroustrup (2nd edition for C++17, 3rd edition for C++20) |
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. |
|
Accelerated C++ |
Andrew Koenig and Barbara Moo, 1st Edition - August 24, 2000 |
This basically covers the same ground as the C++ Primer, but does so in a quarter 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 to the language. (Historically, it broke new ground by being the first beginner's book to use a modern approach to teaching the language.) Despite this, the C++ it teaches is purely C++98. |
[Review] |
最佳实践
Book |
Author(s) |
Description |
review |
Effective C++ |
Scott Meyers, 3rd Edition - May 22, 2005 |
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. For C++11 and C++14 the examples and a few issues are outdated and Effective Modern C++ should be preferred. |
[Review] |
Effective Modern C++ |
Scott Meyers |
This book is aimed at C++ programmers making the transition from C++03 to C++11 and C++14. This book can be treated like a continuation and "correction" of some parts of the previous book - "Effective C++". They don't cover the same things, but keep similar item-based theme. |
[Review] |
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. |
|
中间的
Book |
Author(s) |
Description |
review |
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. |
|
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] |
More Exceptional C++ |
Herb Sutter |
Covers additional exception safety topics not covered in Exceptional C++, in addition to discussion of effective object-oriented programming in C++ and correct use of the STL. |
[Review] |
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 non-member functions and the single responsibility principle. |
[Review] |
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] |
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. A second edition covering C++11, C++14 and C++17 has been already published. |
[Review] |
C++ 17 - The Complete Guide |
Nicolai M. Josuttis |
This book describes all the new features introduced in the C++17 Standard covering everything from the simple ones like 'Inline Variables', 'constexpr if' all the way up to 'Polymorphic Memory Resources' and 'New and Delete with over aligned Data'. |
[Review] |
C++ 20 - The Complete Guide |
Nicolai M. Josuttis |
This book presents all the new language and library features of C++20. It covers the motivation and context of each new feature with examples and background information. The focus is on how these features impact day-to-day programming, what it means to combine them, and how to benefit from C++20 in practice. (Note that this book was published step-by-step, and the first edition is now complete.) |
|
C++ in Action |
Bartosz Milewski |
This book explains C++ and its features by building an application from ground up. |
[Review] |
Functional Programming in C++ |
Ivan Čukić |
This book introduces functional programming techniques to modern C++ (C++11 and later). A very nice read for those who want to apply functional programming paradigms to C++. |
|
先进的
Book |
Author(s) |
Description |
review |
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 multi-methods) can be implemented efficiently, modularly, and cleanly using generic programming. |
[Review] |
C++ Template Metaprogramming |
David Abrahams and Aleksey Gurtovoy |
|
|
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. A second edition covering C++14 and C++17 has already been published. |
[Review] |
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 type traits, 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. |
|
Large Scale C++ volume I, Process and architecture (2020) |
John Lakos |
Part one of a three-part series extending the older book 'Large Scale C++ Design'. Lakos explains battle-tested techniques to manage very big C++ software projects. If you work in a big C++ software project this is a great read, detailing the relationship between physical and logical structure, strategies for components, and their reuse. |
[Review] |
参考样式-所有级别
Book |
Author(s) |
Description |
review |
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 like it and covers just about everything from the core language to the standard library, to programming paradigms to the language's philosophy. |
[Review] Note: All releases of the C++ standard are tracked in the question "Where do I find the current C or C++ standard documents?". |
C++ Standard Library Tutorial and Reference |
Nicolai Josuttis (updated for C++11) |
The introduction and reference for the C++ Standard Library. The second edition (released on April 9, 2012) covers C++11. |
[Review] |
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/14/17/…参考文献:
工作草案,由GitHub上发布的LaTeX源代码生成的C++编程语言标准。C++标准文件,最新标准工作草案:ISO工作草案C++11/14/17标准(INCITS/ISO/IEC 14882:2011/2014/2017)当然,这是所有C++的最终裁决者。然而,请注意,它纯粹是为愿意花费大量时间和精力来理解它的有经验的用户提供参考。C++17标准以198瑞士法郎的电子形式发布。C++17标准是可用的,但似乎不是以经济的形式提供的——直接从ISO中获得,成本为198瑞士法郎(约合200美元)。对于大多数人来说,标准化之前的最终草案已经足够了(而且是免费的)。许多人更喜欢一个更新的草案,记录可能包含在C++20中的新特性。C++20草稿也可以在GitHub上下载。新C++概述(C++11/14)(仅PDF)(Scott Meyers)(更新为C++14)这些是Scott Meyeers提供的为期三天的培训课程的演示材料(幻灯片和一些讲义),他是一位备受尊敬的C++作者。尽管物品清单很短,但质量很高。C++核心指南(C++11/14/17/17…)(由Bjarne Stroustrup和Herb Sutter编辑)是一个不断发展的在线文档,包括一套使用现代C++的指南。这些指南侧重于相对较高级别的问题,如接口、资源管理、内存管理以及影响应用程序架构和库设计的并发性。该项目由Bjarne Stroustrup和其他人在2015年CppCon上宣布,并欢迎社区的贡献。大多数指南都补充了基本原理和示例,以及对可能的工具支持的讨论。许多规则专门设计为可由静态分析工具自动检查。C++超级常见问题解答(Marshall Cline、Bjarne Stroustrup和其他人)是标准C++基金会的一项努力,旨在统一Marshall Clin和BjarneStroustrup之前单独维护的C++常见问题解答,同时也包含了新的贡献。这些项目主要是在中等水平上解决问题,并且通常以幽默的口吻撰写。并不是所有的项目都完全符合最新版本的C++标准。cppreference.com(C++03/11/14/17/…)(由Nate Kohl发起)是一个wiki,它总结了基本的核心语言特性,并有大量的C++标准库文档。该文档非常精确,但比官方标准文档更容易阅读,并且由于其wiki性质,提供了更好的导航。该项目记录了C++标准的所有版本,该网站允许过滤特定版本的显示。该项目由Nate Kohl在2014年CppCon上介绍。
经典/旧款
注:这些书中包含的一些信息可能不是最新的,或者不再被视为最佳实践。
C++的设计与进化(Bjarne Stroustrup)如果你想知道为什么语言是这样的,这本书就是你找到答案的地方。这涵盖了C++标准化之前的所有内容。C++-(Andrew Koenig和Barbara Moo)[评论]高级C++编程风格和习语(詹姆斯·科皮恩)模式运动的前身,它描述了许多C++特有的“习语”。这当然是一本非常好的书,如果你能抽出时间的话,它可能仍然值得一读,但它已经很旧了,而且与当前的C++不兼容。大型C++软件设计(John Lakos)Lakos解释了管理大型C++软件项目的技术。当然,如果它是最新的,那是一本好书。它早在C++98之前就已经编写好了,并且错过了许多对大型项目很重要的特性(例如名称空间)。如果你需要在一个大型C++软件项目上工作,你可能会想读一读,尽管你需要的不仅仅是一粒盐。在C++对象模型内部(Stanley Lippman)如果您想知道虚拟成员函数通常是如何实现的,以及在多继承场景中基本对象通常是如何在内存中布局的,以及所有这些如何影响性能,那么您将在这里找到关于此类主题的详细讨论。注释C++参考手册(Bjarne Stroustrup,Margaret A.Ellis)这本书是非常过时的,因为它探索了1989年的C++2.0版本-模板、异常、命名空间和新的强制转换尚未引入。尽管如此,本书还是贯穿了当时的整个C++标准,解释了该语言的原理、可能的实现和特性。这不是一本学习C++编程原理和模式的书,而是了解C++语言的各个方面。用C++思考(Bruce Eckel,第2版,2000)。两卷;是一套教程风格的免费入门级书籍。下载:第1卷,第2卷。不幸的是,它们被一些微不足道的错误所破坏(例如,维护临时变量是自动常量),没有正式的勘误表。部分第三方勘误表可在http://www.computersciencelab.com/Eckel.htm,但显然没有维护。科学与工程C++:先进技术和实例介绍(约翰·巴顿和李·纳克曼)这是一本全面而详细的书,试图在数值方法的背景下解释和利用C++中的所有可用特性。它在当时引入了一些新技术,例如奇怪重复模板模式(CRTP,也称为巴顿-纳克曼技巧)。它开创了一些技术,如维度分析和自动区分。它附带了许多可编译和有用的代码,从表达式解析器到Lapack包装器。该代码仍然在线提供。不幸的是,这些书在风格和C++特性上已经有些过时,然而,在当时(1994年,STL之前),这是一次令人难以置信的巡回演出。关于动力学继承的章节理解起来有点复杂,也不是很有用。这本经典书的更新版本包含了移动语义和从STL中学到的经验教训,这将是非常好的。