What this book covers
Chapter 1, C++ Is Very Difficult to Learn, looks at why this is the case: is it the language or is it the teaching method? Should we start with low-level features such as pointers and memory management first, or would it perhaps be better to start with working examples or with the OOP features? Also, does every C++ programmer need to know the same C++? The chapter discusses different approaches to learning a language, with a focus on C++, and decides whether C++ is still difficult to learn today ... with the right method. [Alex]
Chapter 2, Every C++ Program Is Standard-Compliant, covers the question that the title suggests. In an ideal world, maybe they would be! In reality, every C++ program should be compliant. However, as we discover in this chapter, when they stray a little to the left or right, using an obscure compiler extension, dabbling in undefined behavior, or relying on a particular platform’s quirks, you instantly might find yourself in a tangle of errors only decipherable by ancient mystics. So, sure, every C++ program is “compliant” ... until it’s not! [Ferenc]
Chapter 3, There’s a Single C++, and It Is Object-Oriented, examines different paradigms of organizing code, including functional programming, meta programming, and the lesser-known extreme polymorphism. [Alex]
Chapter 4, The Main() Function is the Entry Point to Your Application, covers the topic mentioned in the title. In practice, as we will present in the chapter, the main()
function is like the front door of your application: it’s where everything begins, but if you peek behind it, you’ll often find an intricate web of dependencies, libraries, and OS-dependent system calls that make reaching it feel more like navigating a maze than walking a straightforward path. [Ferenc]
Chapter 5, In a C++ Class, Order Must There Be, explores the fact that, sure enough, there must be order in a C++ class, since problems arise without it! Methods, data members, constructors, a place each must find! Yes, flexibility is, but ignored structure cannot be. Respect not the ordered members’ order request and crumble the class will! Freedom too much, and behavior, undefined, comes, errors, bugs, crashes! Disorder, C++ does not tolerate. With sequence respect, harmony reigns! The most important rules, this chapter presents, where the specified order of C++ concepts matters. Or it might not be specified at all, but still matters. [Ferenc]
Chapter 6, C++ Is Not Memory-Safe, explores the challenges of memory management in C++, the promise of modern language constructs, and their failures, in the context of increased awareness of the general public on software reliability. [Alex]
Chapter 7, There’s No Simple Way to Do Parallelism and Concurrency in C++, looks at the need for parallelism and concurrency, how modern C++ proposes to deal with them, and how the actor model can help design parallelism in your products. [Alex]
Chapter 8, The Fastest C++ Code Is Inline Assembly, covers a fact we were taught three decades ago. While assembly does indeed offer low-level control, modern compilers are highly optimized and often generate more efficient code than hand-written assembly, as we will demonstrate in the chapter. Indeed, inline assembly can improve performance in some cases, but it sacrifices readability and portability, so use it sparingly and only when absolutely necessary. [Ferenc]
Chapter 9, C++ Is Beautiful, asserts that C++ is indeed beautiful because where else can you find a language so gracefully tangled in angle brackets, semicolons, curly braces, and periods? It’s a poetic dance of keywords, templates, ancient macros, and overloaded operators, all elegantly arranged to make even the most seasoned programmers question their life choices. Truly, as the chapter will showcase, C++ syntax is the epitome of beauty, if beauty means a riddle wrapped in an enigma, with just a hint of confusion after preprocessing again the unpreprocessable. [Ferenc]
Chapter 10, There Are No Libraries For Modern Programming in C++, evaluates the need and availability of libraries for C++, the challenges of package management, the difficulties in finding libraries for your target version and architecture, and the increasing problem of supply chain attacks. [Alex]
Chapter 11, C++ Is Backward Compatible ... Even With C, explores backward compatibility because, as we will present in the chapter, C++ inherits the family heirloom: a messy pile of global variables, pointy pointers, and undefined behavior. C++ dutifully keeps these relics alive, allowing the two languages to coexist in an awkward, yet somehow functional, embrace. Compatibility, indeed, because who doesn’t want the thrill of mixing decades-old C code with modern C++? Or with not-so-modern C++? We mean, hey, tradition is important, and we must clamber for a living! [Ferenc]
Chapter 12, Rust Will Replace C++, looks at why we have so many programming languages, how Rust fits into the ecosystem and what it does well, C++’s answer, and the conditions under which Rust might replace C++. [Alex]