Boring C++
Boring C++

Introduction – Why C++ in 2026?

9 min read

Chapter 1: Introduction – Why C++ in 2026?

C++ has been around for over forty years, and every few years someone publishes a convincing argument that it is finally dying. So far they have been wrong. There are more lines of production C++ being written today than at any point in the past two decades — in game engines, databases, operating systems, financial systems, compilers, and machine learning infrastructure. The language is not popular because it is pleasant to use. It is popular because it is one of the very few tools that can produce code that is simultaneously fast, portable, and predictable at scale.

This chapter sets up everything that follows: what C++ actually is in 2026, what this book covers and what it deliberately leaves out, what you will need to get started, and what to expect from the difficulty curve ahead.

1.1 The honest case for C++

Let me be direct about something most C++ introductions try to soften: C++ is not easy to learn. The compiler error messages are sometimes longer than the code that produced them. The language has corners that will bite you without warning. Some things that look like they should work do not. Some things that work look like they should not.

That said, here is why it is worth learning anyway.

C++ is fast. Not "fast for a language with a garbage collector" or "fast once the JIT has warmed up" — genuinely fast, as in: the kind of code you write in C++ runs at roughly the same speed as hand-written assembly for most workloads. When a Python library turns out to be a thin wrapper around C++ code, that is not a coincidence. When a game engine needs to process a hundred thousand game objects sixty times per second, it is written in C++. When a database needs to handle a million transactions, the hot path is written in C++.

C++ is portable. The same source code compiles on Linux, macOS, Windows, embedded systems, and exotic architectures. There is no runtime you depend on, no JVM to install, no interpreter to bundle. The output is an executable.

C++ gives you control. You decide when memory is allocated, how data is laid out, when objects are destroyed. That control is also responsibility — and that responsibility is the source of most of the difficulty. But it means you can write software that is predictable in ways that languages with automatic memory management cannot always be.

None of this means C++ is always the right tool. For web applications, for data analysis, for scripting — Python, JavaScript, Go, and others are often better choices. But when you need the last factor of ten in performance, or when you need to run on hardware with no operating system, or when you are writing something that ten million lines of other code will link against, C++ is frequently the answer.

1.2 "Modern" means C++11 and later

If you have seen old C++ code — the kind with explicit new and delete everywhere, typedef instead of using, and raw pointers passed freely between functions — set it aside. This book does not teach that C++.

The C++ standard was revised in 2011, and the result was so different in spirit from what came before that many practitioners treat it as a different language. The committee has revised the standard every three years since then.

Here is what each revision brought:

C++11 (2011): lambdas, auto, smart pointers (unique_ptr, shared_ptr), move semantics, range-based for loops, nullptr, enum class, threading via std::thread. This is the foundational modern revision — it transformed how C++ is written.

C++14 (2014): small improvements and bug fixes to C++11. Generic lambdas, relaxed constexpr restrictions. Most code targeting C++11 also compiles under C++14.

C++17 (2017): structured bindings, if with initializer, std::optional, std::variant, std::string_view, parallel algorithms, if constexpr. This book uses C++17 as its baseline — it has been supported by all major compilers since 2017 and is universally available.

C++20 (2020): Concepts, Ranges, Coroutines, Modules, std::format, std::span. These are significant additions. Where they simplify things meaningfully, this book uses them and says so explicitly.

C++23 (2023): std::expected, std::print, additional ranges improvements. We mention C++23 where relevant, particularly std::expected in Chapter 9.

Unless otherwise noted, every code listing in this book compiles under C++17. When a listing requires C++20 or C++23, the first line of that section says so.

1.3 Who this book is for (and who it is not for)

This book is for you if:

  • You already know at least one programming language — Python, Java, JavaScript, Go, Rust, C, anything — and you want to add C++ to your toolkit.
  • You need genuine performance and you want to understand how to achieve it, not just call a library that achieves it for you.
  • You are a student or researcher who has a computation-heavy problem and needs to write faster code.
  • You are a software engineer who keeps hearing "we should rewrite this hot path in C++" and finally wants to understand what that involves.
  • You prefer complete programs and honest explanations over impressive-sounding vocabulary.

This book is not for you if:

  • You already write production C++ daily. You will not find new depth here; you will find a well-organized introduction.
  • You want to learn the very latest C++23 features as the primary subject of a book. We cover them where useful, but C++17 is the foundation.
  • You are specifically looking to write game engine graphics, embedded firmware, or operating system kernels. C++ is used heavily in all three domains, but each has domain-specific concerns beyond what this book covers.
  • You want to learn C first. This book assumes you are comfortable with programming concepts (variables, loops, functions, arrays) but does not assume C knowledge. We introduce C++ features directly.

1.4 What you will need

Hardware: a laptop or desktop running Linux, macOS, or Windows. Nothing special. No GPU required.

Software:

  • A C++17-capable compiler: gcc ≥ 10, clang ≥ 12, or MSVC 2019 or later.
  • cmake (version 3.16 or later) for multi-file projects.
  • An editor you like. We recommend VS Code with the Microsoft C/C++ extension, but any editor that handles plain text works fine.

We walk through the entire installation in Chapter 2. You do not need to do anything right now — just make sure you have a machine you can install software on.

1.5 How the book is organized

The book builds deliberately, adding one layer at a time:

  • Chapters 1–2: Introduction and setup. Getting your tools installed and your first program running.
  • Chapters 3–4: The building blocks — types, variables, control flow, functions, lambdas. This is where you learn the language's basic vocabulary.
  • Chapters 5–6: The harder part — classes, objects, and memory. Chapter 6 in particular covers ownership, smart pointers, move semantics, and RAII. This is where most people slow down.
  • Chapters 7–8: Templates and the standard library. Generic programming and the containers and algorithms you will use every day.
  • Chapters 9–10: Error handling and concurrency. What to do when things go wrong; how to run code in parallel.
  • Chapter 11: Modern C++ idioms and best practices. A collection of techniques that make code safer, clearer, and more efficient.
  • Chapter 12: A complete project from scratch — a command-line task manager that uses almost everything from the previous eleven chapters.

Each chapter ends with exercises (Easy, Medium, Stretch), a list of common mistakes, and a short summary.

1.6 A realistic expectation of the difficulty curve

Chapters 1 through 4 will feel manageable for anyone who has written code before. The concepts are not new — you know what a loop is, what a function is, what a variable is. The syntax is unfamiliar in places, and the type system is more strict than Python's, but there is nothing that should stop you.

Chapters 5 and 6 are where the road gets steeper. Classes are not difficult in concept, but the details — constructors, destructors, copy semantics, move semantics, smart pointers, RAII — take time to internalize. Chapter 6 in particular is the one most people read twice. That is fine. Expected, even. Read it, work through the exercises, and then come back and read the section on move semantics again a week later. It will make more sense the second time.

Chapter 7 (templates) is the other hard chapter. The compiler error messages you get when you use a template incorrectly are notoriously long and cryptic. The C++20 Concepts feature exists specifically to make those errors readable, and we use it — but even with Concepts, template errors take getting used to. If Chapter 7 feels confusing on the first pass, work through the examples, skip the stretch exercise, and keep going. Chapter 8 will clarify why templates matter.

By Chapter 12, if you have worked through the exercises in each chapter, the patterns that seemed foreign in Chapter 5 will feel routine. Not automatic — there is no shortcut to automatic — but routine. You will write a class without having to think about the Rule of Five. You will reach for unique_ptr before reaching for new. That is what this book is trying to build.

1.7 The "boring" philosophy

Boring code is code your colleague can read at 11pm on a Friday without a cup of coffee. It does not rely on clever tricks. It does not use a feature just because the feature exists. It solves the problem at hand using the most obvious mechanism available.

In this book, boring means something more specific: every concept is introduced once, clearly, and then repeated with small variations until it stops being a thing you have to look up. Every code listing compiles and runs. When something is genuinely hard to understand — and some things are — we say so, and then we explain it two more ways.

You will see the same basic patterns throughout this book: acquire a resource in a constructor and release it in a destructor; use smart pointers instead of raw new and delete; reach for const by default and remove it only when you have a reason. These patterns appear in every chapter because they are always relevant. That repetition is not laziness on my part. It is the mechanism by which knowledge becomes instinct.

1.8 Let's get started

Chapter 2 is setup. If you already have a compiler installed and want to verify it works with C++17, you can compile the Hello World program in Section 2.4 and if it succeeds you can skim the rest of Chapter 2.

If you are starting from scratch — no compiler, no editor, not sure where to begin — Chapter 2 walks through the complete installation step by step for Linux, macOS, and Windows, with exact commands and a troubleshooting section for the things that commonly go wrong.

After setup, Chapter 3 starts the actual language. Things get interesting quickly from there.

Boring C++

Modern C++ Mastery for Programmers Who Prefer Clarity Over Cleverness.

View book →