3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup
Book changes and reception
- Third edition is about half the size of the second; much reference/broadening material was moved online, justified by better web docs.
- Some like the lighter, more focused text; others note that the full “real” amount of C++/STL material is now effectively split across book + web.
- ISBN on the page was initially wrong (pointing to a different book) but quickly corrected after a reader email.
Learning C++ and recommended resources
- Thread mentions this book, “A Tour of C++”, “Effective C++” (now seen as dated), and other modern C++ courses and books.
- Advice: this book is a solid conceptual intro; the “Tour” is good for quickly getting up to modern C++.
- Strong warnings to be cautious with older C++ literature that emphasizes heavy inheritance and pre‑modern idioms.
C++ style and best practices
- Several commenters argue against writing “C with classes”; recommend embracing modern C++:
- Prefer
std::string,std::vector,std::array, standard containers/algorithms over C arrays and hand‑rolled data structures. - Minimize raw pointers and
malloc; use RAII, smart pointers when needed, references otherwise. - Be conservative with
auto; helpful for iterators, but overuse can hurt readability. - Avoid
volatileand inline asm unless doing low‑level hardware work; use atomics for concurrency. - Templates and metaprogramming are powerful but easy to misuse; not required for most application code.
- Prefer
OOP vs composition
- Multiple comments stress modern C++ preference for composition and interfaces over deep inheritance hierarchies.
- Classic “Animal/Dog” inheritance style is seen as overused; dynamic polymorphism is now “use when necessary, not by default.”
Language choice and ecosystem
- Some argue C++ is still central in high‑performance domains (games, trading, rendering, HPC, database engines, audio plugins), so worth learning.
- Others counter that C++’s complexity and backward‑compatibility constraints undermine “extreme performance” and safety; point to Rust and domain‑specific tools.
- There’s nostalgia for large all‑C++ stacks (including UIs), contrasted with current prevalence of higher‑level languages.
Performance debate
- Extended debate on whether C++’s design (e.g., move semantics,
std::vector::reserve) introduces unavoidable small performance leaks versus being “fast enough” and fixable with custom containers or intrinsics. - No consensus: one side emphasizes theoretical and corner‑case overheads; the other stresses real‑world success of high‑performance C++ systems.
Modules and import std;
- Several note that the book’s very first examples use
import std;, but mainstream compilers and toolchains often don’t support this cleanly yet. - This is seen as a poor fit for beginners who will likely hit cryptic compiler/module errors; some point to CMake + newer compilers as partial workarounds, but setup is nontrivial.
GUI and libraries
- New edition switches from FLTK to Qt for GUI; seen as more aligned with industry practice.
- Notes that the book uses a wrapper over Qt, possibly hiding much of Qt proper.
- Discussion clarifies Qt Creator (IDE) vs Qt (library) and how Creator makes Qt development smoother, though it’s still a general C++ IDE.
Namespaces and readability
- Debate over
using namespace std;:- Some like it for reducing visual noise; others warn it should never appear in headers and rarely in implementation files due to name clashes, especially as the standard library grows.
- Broader disagreement on whether longer, fully qualified names improve clarity or just add syntactic noise; both sides argue from long‑term maintainability and readability perspectives.