🔑Go deeper — read the bookC++ Keywords by Version — Specifiers & Attributes— runnable code & full walkthrough →

cpp core · medium

C++ keywords by version — a specifier & attribute timeline

A single timeline of the C++ keywords, specifiers and attributes that matter in interviews, grouped by the standard that introduced them (C++98/03 through C++23), each with a one-line significance. Pairs with the deep-dive book that gives a small code example for every one.

🔑 Key line

Each C++ standard added specifiers/attributes that change SEMANTICS: explicit, mutable, volatile (98) -> noexcept, constexpr, override/final, auto (11) -> if constexpr, [[nodiscard]], structured bindings (17) -> concept, consteval, [[likely]], co_* (20) -> [[assume]], if consteval, deducing this (23).

The code

// ── C++98/03 ───────────────────────────
struct Box {
explicit Box(int);
mutable int hits;
};
virtual void draw();
inline int helper();
// ── C++11 ──────────────────────────────
constexpr int sq(int x) {
return x * x;
}
void g() noexcept;
auto a = 1;
decltype(a) b;
void f() override final;
int* p = nullptr;
// ── C++14 ──────────────────────────────
[[deprecated("use v2")]] void old();
decltype(auto) fwd();
// ── C++17 ──────────────────────────────
if constexpr (sizeof(int) == 4) { /* ... */
}
inline int counter = 0;
[[nodiscard]] int make();
auto [k, v2] = *map.begin(); // structured binding
// ── C++20 ──────────────────────────────
template <std::integral T>
T twice(T);
consteval int cube(int);
constinit int z = 0;
if (x) [[likely]] {}
co_yield value;
// ── C++23 ──────────────────────────────
[[assume]] (n > 0);
if consteval { /* ... */
}
auto c = auto(expr); // explicit decay-copy

What this lesson walks through

  1. 01C++98/03 — the classic specifiers
  2. 02C++11 — the big leap
  3. 03C++14 — small but useful
  4. 04C++17 — ergonomics & attributes
  5. 05C++20 — constraints, coroutines, hints
  6. 06C++23 — the latest polish

Before the modern era, a handful of specifiers already carried real semantic weight — and they still trip people up in interviews. `explicit` stops a one-argument constructor from silently converting; `mutable` lets a member change inside a `const` method (think a cache); `volatile` forbids caching the value (memory-mapped I/O, signal handlers — it is NOT a threading tool); `virtual` turns on vtable dispatch; `inline` is about the One-Definition-Rule, not speed.

See it animated — step by step, at your own pace

Unlock the full interactive walkthrough of C++ keywords by version — a specifier & attribute timeline and 100+ animated C++ interview lessons.

← Previous
Exception-Safety Guarantees
Next →
Struct Alignment & Padding