问题:权威的C ++书籍指南和清单

这个问题试图收集每年出版的数十本不良C ++书籍中的珍珠。

与许多其他编程语言不同,这些语言通常是在Internet上的教程中经常使用的,而很少有人能够在不学习精心编写的C ++书籍的情况下快速使用C ++。这样做太大而复杂。实际上,它是如此之大和复杂,以至于 那里有很多非常糟糕的C ++书籍 。而且,我们并不是在谈论不良的风格,而是谈论诸如明显的事实错误促进严重的不良编程风格之类的事情。

请编辑接受的答案以提供优质书籍和大致的技能水平-在 讨论您在中添加的内容后,最好 href=" http://chat.stackoverflow.com/rooms/10/loungec"> C ++聊天室 。 (如果常规员工不同意建议,他们可能会毫不留情地撤消您的工作。)为您亲自阅读/从中受益的每本书添加简短的简介/说明。随时讨论质量,标题等。符合条件的书籍将添加到列表中。具有C和C ++用户协会(ACCU)的评论的书籍具有该评论的链接。

*注意:常见问题解答和其他资源可以在 C ++标记信息和在

标签:c++,c++-faq

Q: 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.

Please edit the accepted answer to 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.

*Note: FAQs and other resources can be found in the C++ tag info and under .

回答1:

入门

简介,以前没有编程经验

*不要与 C ++ Primer Plus (斯蒂芬·普拉塔(Stephen Prata)),而评论

简介,已有编程经验

  • C ++之旅 (Bjarne Stroustrup)( 第二版C ++ 17 ),"旅行"是快速(约180页和14章)对所有标准C ++(语言和标准库,并使用C ++ 11 )的教程概述,适用于中高级程度,适用于已经了解C ++的人或至少是有经验的程序员。本书是构成C ++编程语言第4版第2-5章的材料的扩展版本。

  • C ++加速 (Andrew Koenig和Barbara Moo,第一版-2000年8月24日)这基本上涵盖了与 C ++ Primer 相同的领域,但涵盖了其空间的四分之一。这主要是因为它并非试图成为 programming 的介绍,而是试图为先前使用其他语言进行编程的人们介绍 C ++ 。它的学习曲线陡峭,但是,对于那些可以应付的人来说,它是对语言的非常紧凑的介绍。 (从历史上看,它是第一本使用现代方法教授语言的初学者书籍,开辟了新天地。)尽管如此,它所教授的C ++纯粹是C ++ 98。 [评论]

最佳做法

  • 有效的C ++ (斯科特Meyers,第3版-2005年5月22日),其目的是成为C ++程序员应该阅读的最好的第二本书,并且成功了。早期版本针对的是C语言的程序员,第三版本对此进行了更改,并针对Java之类的程序员。它以易于访问(和愉快)的风格呈现了约50个易于记忆的经验法则及其原理。对于C ++ 11和C ++ 14,示例和一些问题已过时,应首选"有效的现代C ++"。 [评论]

  • 有效的现代C ++ ( Scott Meyers),这基本上是 Effective C ++ 的新版本,目的是让C ++程序员从C ++ 03过渡到C ++ 11和C ++ 14。

  • 有效的STL (Scott Meyers),旨在对标准库中来自STL的部分执行相同的操作,即 Effective C ++ 对整个语言所做的贡献:它提供了经验法则及其基本原理。 [评论]

中级


高级

  • 现代C ++设计 ( Andrei Alexandrescu)有关高级通用编程技术的开创性著作。介绍基于策略的设计,类型列表和基本的通用编程习惯用法,然后说明可以使用通用编程高效,模块化和干净地实现多少有用的设计模式(包括小对象分配器,函子,工厂,访问者和多方法) 。 [评论]

  • C ++模板元编程 ( David Abrahams和Aleksey Gurtovoy)

  • C ++并发运行 (安东尼·威廉姆斯)这本书涵盖了C ++ 11并发支持,包括线程库,原子库,C ++内存模型,锁和互斥锁,以及设计和调试多线程应用程序的问题。涵盖C ++ 14和C ++ 17的第二版已发布

  • 高级C ++元编程 ( Davide Di Gennaro)TMP技术的C ++ 11之前的手册,更多地关注实践而不是理论。本书中有很多片段,其中一些由于类型特征而变得过时,但是仍然可以了解一些技巧。如果您可以忍受古怪的格式/编辑,那么它比Alexandrescu更容易阅读,并且可以说是更有收获的。对于更有经验的开发人员,您很有可能会从C ++的一个黑角(怪癖)中获得一些东西,而这通常只能通过丰富的经验来实现。


参考风格-所有级别

C ++ 11/14/17 /…参考:

  • C ++ 11 / 14 / 17 标准(INCITS / ISO / IEC 14882:2011/2014/2017)当然,这是所有C ++和非C ++的最终仲裁者。但是请注意,它纯粹是为愿意为理解它的经验丰富的用户提供参考。 C ++ 17标准以电子形式发布,价格为198瑞士法郎。

  • C ++ 17标准可用,但似乎不是经济形式– 直接来自ISO 的价格为198瑞士法郎(约合200美元)。对于大多数人来说,标准化前的最终草案绰绰有余(免费)。许多人会喜欢更新的草案 ,记录了可能包含在C ++ 20中的新功能。

  • 新C ++概述(C ++ 11/14)(仅PDF) ) (Scott Meyers)(已针对C ++ 14更新),这些是Scott提供的为期三天的培训课程的演示材料(幻灯片和一些讲义) Meyers,他是C ++上受人尊敬的作者。即使项目列表很短,质量也很高。

  • C ++核心准则(C ++ 11 / 14/17 /…) (由Bjarne Stroustrup和Herb Sutter编辑)是一个不断发展的在线文档,其中包含一组有关正确使用现代C ++的准则。该指南侧重于相对较高级别的问题,例如接口,资源管理,内存管理以及影响应用程序体系结构和库设计的并发性。该项目是 Bjarne Stroustrup等人在CppCon'15上宣布的,并欢迎社区的贡献。大多数准则都补充有基本原理和示例以及有关可能的工具支持的讨论。许多规则经过专门设计,可以由静态分析工具自动检查。

  • C ++超级常见问题解答 (Marshall Cline,Bjarne Stroustrup和其他人)是标准C ++基金会的一项工作,旨在统一先前由Marshall Cline和Bjarne Stroustrup分别维护的C ++常见问题解答,并且还加入了新的贡献。这些项目大多以中级水平解决问题,并且通常以幽默的语气写出来。并不是所有的项目都可能是最新版本的C ++标准的最新版本。

  • cppreference.com(C ++ 03/11/14/17 /…) (由Nate Kohl发起)是一个Wiki,概述了基本的核心语言功能,并且具有有关C ++标准库的大量文档。该文档非常精确,但是比官方标准文档更易于阅读,并且由于其Wiki性质,因此提供了更好的导航。该项目记录了C ++标准的所有版本,并且该站点允许过滤特定版本的显示。该项目为由Nate Kohl在CppCon'14上展示


经典/较旧

注意:这些书中包含的某些信息可能不是最新信息,或者不再被视为最佳做法。

A1:

Beginner

Introductory, no previous programming experience

  • 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]

  • 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.

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

Introductory, with previous programming experience

  • A Tour of C++ (Bjarne Stroustrup) (2nd edition for C++17) 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 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 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]

Best practices

  • 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 is basically the new version of Effective C++, aimed at C++ programmers making the transition from C++03 to C++11 and C++14.

  • 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

  • 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 overaligned Data'.

  • C++ in Action (Bartosz Milewski). This book explains C++ and its features by building an application from ground up


Advanced

  • 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 been already published.

  • 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.


Reference Style - All Levels

  • 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 this question: Where do I find the current C++ standard.

  • 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/… References:

  • The C++11/14/17 Standard (INCITS/ISO/IEC 14882:2011/2014/2017) 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. The C++17 standard is released in electronic form for 198 Swiss Francs.

  • The C++17 standard is available, but seemingly not in an economical form – directly from the ISO it costs 198 Swiss Francs (about $200 US). For most people, the final draft before standardization is more than adequate (and free). Many will prefer an even newer draft, documenting new features that are likely to be included in C++20.

  • Overview of the New C++ (C++11/14) (PDF only) (Scott Meyers) (updated for 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.

  • The C++ Core Guidelines (C++11/14/17/…) (edited by Bjarne Stroustrup and Herb Sutter) is an evolving online document consisting of a set of guidelines for using modern C++ well. The guidelines are focused on relatively higher-level issues, such as interfaces, resource management, memory management and concurrency affecting application architecture and library design. The project was announced at CppCon'15 by Bjarne Stroustrup and others and welcomes contributions from the community. Most guidelines are supplemented with a rationale and examples as well as discussions of possible tool support. Many rules are designed specifically to be automatically checkable by static analysis tools.

  • The C++ Super-FAQ (Marshall Cline, Bjarne Stroustrup and others) is an effort by the Standard C++ Foundation to unify the C++ FAQs previously maintained individually by Marshall Cline and Bjarne Stroustrup and also incorporating new contributions. The items mostly address issues at an intermediate level and are often written with a humorous tone. Not all items might be fully up to date with the latest edition of the C++ standard yet.

  • cppreference.com (C++03/11/14/17/…) (initiated by Nate Kohl) is a wiki that summarizes the basic core-language features and has extensive documentation of the C++ standard library. The documentation is very precise but is easier to read than the official standard document and provides better navigation due to its wiki nature. The project documents all versions of the C++ standard and the site allows filtering the display for a specific version. The project was presented by Nate Kohl at CppCon'14.


Classics / Older

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

  • 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++.

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

  • 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 might still be worth a read if you can spare the time, but quite old and not up-to-date with current C++.

  • 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. The first volume of a new edition is released in 2019.

  • 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.

  • The Annotated C++ Reference Manual (Bjarne Stroustrup, Margaret A. Ellis) This book is quite outdated in the fact that it explores the 1989 C++ 2.0 version - Templates, exceptions, namespaces and new casts were not yet introduced. Saying that however, this book goes through the entire C++ standard of the time explaining the rationale, the possible implementations, and features of the language. This is not a book to learn programming principles and patterns on C++, but to understand every aspect of the C++ language.

  • Thinking in C++ (Bruce Eckel, 2nd Edition, 2000). Two volumes; is a tutorial style free set of intro level books. Downloads: vol 1, vol 2. Unfortunately they’re marred by a number of trivial errors (e.g. maintaining that temporaries are automatically const), with no official errata list. A partial 3rd party errata list is available at (http://www.computersciencelab.com/Eckel.htm), but it’s apparently not maintained.

  • Scientific and Engineering C++: An Introduction to Advanced Techniques and Examples (John Barton and Lee Nackman) It is a comprehensive and very detailed book that tried to explain and make use of all the features available in C++, in the context of numerical methods. It introduced at the time several new techniques, such as the Curiously Recurring Template Pattern (CRTP, also called Barton-Nackman trick). It pioneered several techniques such as dimensional analysis and automatic differentiation. It came with a lot of compilable and useful code, ranging from an expression parser to a Lapack wrapper. The code is still available here: http://www.informit.com/store/scientific-and-engineering-c-plus-plus-an-introduction-9780201533934. Unfortunately, the books have become somewhat outdated in the style and C++ features, however, it was an incredible tour-de-force at the time (1994, pre-STL). The chapters on dynamics inheritance are a bit complicated to understand and not very useful. An updated version of this classic book that includes move semantics and the lessons learned from the STL would be very nice.

回到顶部