Skip to content
Tutorials Center
My learning

Topics

C++ Reference ยท Preprocessor, Tools and Concepts

C++ glossary

A glossary of key C++ terms: ADL, ODR, RAII, SFINAE, lvalue and rvalue, undefined behavior, aggregates, translation units and more, with short examples.

C++ has a large vocabulary, and many words (such as "object", "value", "type" or "linkage") have precise meanings that differ from everyday programming talk. This glossary defines the terms you meet most in reference pages, compiler messages and code reviews, in alphabetical order, with links to the page that covers each in depth.

Two short programs below make a few of the slipperiest terms concrete.

C++
int x = 5;      // x is an lvalue; 5 is a prvalue

Try it

C++ Value categories and argument-dependent lookup

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with std::cin or std::getline), it gets the next line from this box.

C++ RAII, SFINAE and constexpr

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with std::cin or std::getline), it gets the next line from this box.

Terms

Term Meaning
ABI Application binary interface: the binary-level rules (layout, calling convention, name mangling) that compiled code must agree on.
ADL Argument-dependent lookup: unqualified function names are also searched in the namespaces of the argument types. See name lookup.
Aggregate A class or array that can be initialized with braces member by member: no user-provided constructors, no private data, no virtual functions.
Concept A named, compile-time predicate on template arguments (C++20). See concepts.
CRTP A class derived from a base template instantiated with itself. See CRTP.
CTAD Class template argument deduction: std::pair p{1, 2.0};. See CTAD.
Declaration / definition A declaration introduces a name; a definition also creates the entity (allocates storage, provides the body).
Dangling reference A reference or pointer to an object whose lifetime has ended. Using it is undefined behavior.
Copy elision The compiler constructs an object directly in its final location, skipping a copy or move; mandatory in many C++17 cases. See copy elision.
Forwarding reference T&& where T is deduced; binds to lvalues and rvalues. See forwarding references.
Header unit / module Compiled interface units that replace textual #include (C++20). See modules.
Implementation-defined Behavior that varies between compilers but must be documented (for example sizeof(int)).
Linkage Whether a name refers to the same entity across translation units: external, internal (static, unnamed namespace) or none.
lvalue / rvalue Roughly "has an identity / can be moved from". The full set is glvalue, prvalue and xvalue. See value categories.
Move semantics Transferring resources from an expiring object instead of copying them. See rvalue references.
ODR One Definition Rule: a program may contain at most one definition of each non-inline entity. See ODR.
Overload resolution Choosing which function to call among same-named candidates. See overload resolution.
POD / trivial type A type that can be copied with memcpy; the modern terms are trivially copyable, trivial and standard-layout.
RAII Resource acquisition is initialization: lifetime of a resource tied to an object. See RAII.
Rule of zero / three / five Guidelines for which special member functions to write. See rule of five.
SFINAE Substitution failure is not an error: a failed template substitution removes the candidate instead of failing the build. See SFINAE.
Slicing Copying a derived object into a base object, losing the derived part. See slicing.
Translation unit One source file after the preprocessor has expanded its #includes; the unit the compiler compiles.
Undefined behavior The standard places no requirements on the program; anything can happen. See undefined behavior.
Unspecified behavior One of several valid outcomes, with no documentation required (for example evaluation order of arguments).
Value-initialization Initialization with T() or T{}: zeroes scalars and builds class objects. See initialization.
Vtable The per-class table of virtual function addresses that implements dynamic dispatch (an implementation technique, not required by the standard).

Usage notes

  • Declaration versus definition is the root of many link errors: "undefined reference" means a declared entity has no definition in any linked object; "multiple definition" breaks the ODR.
  • Undefined, unspecified and implementation-defined behavior are different. Only undefined behavior permits the compiler to assume the situation never happens.
  • "Object" in C++ means a region of storage with a type, not only class instances; an int variable is an object.
  • Terminology moves. "POD" is deprecated in favor of precise categories; "lvalue/rvalue" was refined in C++11 with xvalue and prvalue.
  • Look up terms by their standard names when reading diagnostics; compilers use them in messages (for example "narrowing conversion", "ill-formed", "ambiguous overload").