C++ Reading List

http://www.drdobbs.com/cpp/c-reading-list/240155654?pgno=6

 

中文翻译版 [ C++11标准后的C++阅读书目](http://blog.jobbole.com/47357/)

 

 

1.

C++ Programming Language, 4th Edition

by Bjarne Stroustrup

This book is rightfully viewed as the "Bible" of C++ programming. It's the authoritative exposition of the language, its features, and its peculiarities, all written with considerable clarity by Stroustrup, who designed C++. Some readers might view the ANSI C++ document as a more definitive source of information, but it is a rather terse reference resource intended for readers who already know the language. This book, in contrast, gives friendly explanations of new features, coupled with advice on things to do and practices to avoid, making it a more approachable choice for readers needing to understand specific features. In this sense, this book is more a reference than a tutorial.

Some physical aspects detract from the book, especially the choice of printing code without using a monospaced font. No matter how aesthetically pleasant this might look to some readers, it throws off regular readers of code, who expect vertical alignments that no longer appear. Despite this, the typesetting of the code is much better than in previous editions. A second concern is one that has to do more with C++ itself than the book. This edition is 1328 pages long. That is roughly 1000 pages more than the original edition. As Stroustrup gives scant coverage of the libraries, these numbers are indicative of how much more complex C++ has become. These concerns notwithstanding, I don't see how serious C++ programmers looking to use the new features of the language can proceed without this work. Definitely recommended.

 

2.

C++ Primer, 5th Edition

by Stanley Lippman, Josée Lajoie, and Barbara Moo

For many years, the C++ Primer has been the definitive tutorial to C++. This edition has been updated for the C++11 standard and completely rewritten. At 900 densely packed pages, it explores in great detail every nook and cranny of the language. This is perhaps an understatement. The tone and contents of the book are far removed from what the word "primer" in the title would imply. There is no section for "coming up to speed quickly" on the language. Rather, there is an almost indefatigable quality to the text as it makes sure to cover every aspect of the language and to foresee the possible problems a C++ programmer might encounter. Ever wonder what havoc would be caused by marking a destructor as a C++11 "deleted function"? Nor have I. But it's answered in detail in this book with references to other sections for additional supporting information.

The book covers only the language, as such. There are passing discussions of the library and an appendix that summarizes the various header files and algorithms in the library. (For an excellent presentation on the C++ library, I recommend the excellent The C++ Standard Library: A Tutorial and Reference, which is discussed next). Between the two books, it's fair to say, almost anything you'd want to know about C++ is explained thoroughly. While Stroustrup's C++ Programming Language, 4th Ed., reviewed earlier, appears to be a competitor to this volume, Stroustrup's tome is primarily a reference book with explanations and occasional counsel, whereas this volume is much more pragmatic. It discusses problems that occur if you use features incorrectly, contains a lot more code, and in general, offers far more guidance than the Stroustrup book.

My only hesitation about this book is that it's clearly designed for readers who already know the basics of the language. I would not recommend this book to students or even experienced programmers getting into C++ for the first time. The level of detail is too great to read fast enough to become productive quickly in the language. But for existing C++ developers, especially those wanting to use the new features in C++11, this book is an excellent choice.

 

3.

The C++ Standard Library, 2nd Edition

by Nicolai Josuttis

This is a second edition of the classic tutorial and reference on the C++ Standard library, updated for C++11. Unlike many books that cover libraries and APIs, this is not a glorified explanation of a bunch of function calls. Rather, it breaks the standard library (mostly the STL) into sensible subsections and explains the fundamental approaches taken in the design of the components treated in the section. Only then does the author get into the APIs in detail, ending with a summary of all the other methods that might be useful, accompanied by short explanations. The section on containers is a masterpiece of explanation of design, internals, application, and comparison between the various choices.

The discussions are cogent, clear, and remarkably informative. For example, the chapter on STL function objects and lambdas spends 12 pages just explaining what function objects are and why you'd use them. Only after this explication does the author explain the predefined function objects (another 12 pages). At that point, he's laid the groundwork for the final discussion: the journey into lambdas. And so it goes for more than 1,000 pages all told. The explanations are often illustrated by short, complete programs that highlight an important point, so you can see exactly how a function might be used or applied.

The first edition of this book is considered by many C++ programmers to be a true classic. I see no reason why the second edition should not be also. Highly recommended both as an upgrade to the first edition and as a new volume to readers unfamiliar with this work — and as an excellent complement to the first two books in this review.

 

4.

C++ Concurrency in Action

by Anthony Williams

This book is a deep dive into concurrency using C++11 features. It's written by the primary developer and maintainer of the Boost Thread library, which is the basis for much of the language's new threading support. In sum, it's written by a highly qualified author.

It starts off with the basics, assuming the reader has good (even very good) command of the language, but is new to writing parallel code. It steps through the problems posed by concurrency, the solutions and limitations of mutual exclusion, and how they're implemented in C++11. It then moves through the C++ memory model and atomic types. Finally, it digs into the design of lock-based and lock-free data structures. It's the best treatment I've seen of these topics since Herb Sutter discussed them in our pages.

The book thoughtfully covers topics of real importance that are frequently overlooked in other treatments; namely, designing code for multithreading and debugging threaded applications. Of these, both treatments are too short in my view. A large part of the book is reference material (almost 130 pages on the C++ threading library alone). And another appendix is a full message-framework all laid out in code with explanations throughout. There's no doubt the author has done his homework.

 I have a few small complaints, but they are truly small. The first is that you must have in-depth knowledge of C++, good-enough-to-skate-by won't be enough for this book. Second, the author consigns thread pools to the final chapters under the rubric of "Advanced Threading." In my opinion, pools mark the point at which concurrency gets really interesting; but here, it's where the author stops. Predictably, given this orientation, he does not ever address the Actor model, which gets a single passing mention in the index. It's as if this approach did not exist at all, even though it's integral to several languages — just not, in Williams' view, C++.

Overall, these complaints reflect my preferences, rather than any flaws that invalidate the book. Williams' work is an excellent treatment and likely to be the defining title in this area for a long time to come.  

If you want a closer look at content from this book, we recently published an excerpt from it, in a popular article: "Waiting for One-Off Events with Futures."

 

5.

Secure Coding in C and C++, 2nd Edition

by Robert Seacord

This is the definitive work on writing secure code in C/C++. This new edition, which nearly doubles the size of the original 2005 work, illustrates how much we've learned in the interim about attacks on code. In fact, in reading through this book, one feels almost overwhelmed by the variety and imagination of attacks today. However, as the author capably explains, security is more than just the implementation of counter-techniques, but a mind-set that weaves security throughout the implementation. Only through such a consistent mindset, he argues, can the damage wrought by future attack methods be contained.

The book details numerous kinds of hacks and what can be done to prevent them or make them so difficult as to discourage the hacker. The explanations are remarkably well written and the code is clear. However, it requires a more-advanced formation than most books on programming: It needs the reader to have a fairly good idea of how C and C++ programs execute and what is happening at the machine level. Because the required information is not provided in the text, it's not possible to get the true value from the suggestions without having done this homework first.

For developers who can follow along and understand the inner workings of program execution, this book is not only an excellent guide, but a revelation. For example, Seacord's discussions of how attacks are enabled by doubly freeing an allocated chunk of memory highlights a feature of this simple coding error that might be completely overlooked if you were not a security expert. The explanation is illuminating.

The hands-on nature of this volume is exemplified by frequent recommendations of tools to use to verify code and lock down access mechanisms that crackers like to exploit. This is an excellent volume that will very definitely make you a more aware, and certainly better, programmer.

6.

Real-Time C++

by Chris Kormanyos

This is a gentle introduction to using C++11 in real-time projects. The author presents several basic projects and shows how he used C++11 to code them. He starts with a product that targets an Atmel AVR microcontroller, which he programs using the GCC toolchain, explaining along the way: the design, implementation in hardware and code, and finally how to flash and execute the program. It turns on LEDs under various circumstances. He then moves on to more-ambitious projects, such as writing low-level hardware drivers in C++. In the final chapters, he examines extending the standard C++ library and the STL for embedded purposes.

The book is approachable and the code fairly clean. It shows that C++11 is a reasonable choice for embedded work. Overall, this is a good tutorial for C++ developers who want to get their feet wet in embedded programming, but due to the choice of sample projects, it probably won't appeal to programmers already active in that line of work.

posted @   scott_h  阅读(169)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示