CppGlossary

Glossary

Quick definitions for terms used throughout this tutorial and in C++ discussions generally. Use it as a reference when a page uses a term you've forgotten or haven't reached yet.

Term

Definition

RAII

Resource Acquisition Is Initialization — tying a resource’s lifetime to an object’s lifetime, so its destructor automatically releases it.

Undefined Behavior

A situation the C++ standard places no requirements on — anything can happen, including appearing to work. Common causes: reading uninitialized memory, out-of-bounds access, dangling pointers.

Move Semantics

Transferring ownership of a resource from one object to another instead of copying it, using rvalue references — avoids expensive, unnecessary duplication.

Smart Pointer

A class that wraps a raw pointer and manages its lifetime automatically via RAII (e.g. unique_ptr, shared_ptr, weak_ptr).

Template

A blueprint for generating functions or classes that work with any type, with the concrete type filled in by the compiler at compile time.

Virtual Function

A member function that can be overridden in a derived class, and is resolved at runtime based on the object’s actual type rather than the pointer/reference type.

Vtable

A per-class table of function pointers the compiler generates to implement dynamic dispatch of virtual functions at runtime.

STL

The Standard Template Library — the collection of containers, iterators, algorithms, and function objects included with the C++ standard library.

Rule of Three

If a class needs a custom destructor, copy constructor, or copy assignment operator, it almost certainly needs all three.

Rule of Five

The Rule of Three extended for move semantics: also define a move constructor and move assignment operator when the class manages a resource directly.

Rule of Zero

Prefer designing classes that need none of the five special member functions written by hand, by composing them entirely from RAII members (like std::vector, std::unique_ptr).

Rvalue

A temporary value with no persistent memory address that code can name again (e.g. the result of a + b) — can bind to rvalue references.

Lvalue

A value that has an identifiable memory location and a name you can refer to again (e.g. a variable) — can appear on the left side of an assignment.

Header File

A file (typically .h or .hpp) containing declarations — function signatures, class definitions — that other source files #include to use them.

Translation Unit

A single .cpp file after the preprocessor has expanded all its #includes — the actual unit the compiler compiles independently.

Linker

The tool that combines compiled object files (and libraries) from separate translation units into one final executable, resolving references between them.

ABI

Application Binary Interface — the low-level contract (calling conventions, data layout) that lets separately compiled binaries interoperate correctly.

Compile Time vs Runtime

Compile time is when the compiler translates source code to machine code (and can catch type errors, run constexpr code); runtime is when the compiled program actually executes.

Namespace

A named scope that groups identifiers to avoid naming collisions between different parts of a program or different libraries.

Const Correctness

Consistently marking values, parameters, and member functions as const wherever they are not meant to be modified, so the compiler enforces that intent.

Iterator

An object that points to an element within a container and can be advanced to visit the next one, generalizing the idea of a pointer for STL algorithms.

Container

A data structure that stores a collection of elements, such as std::vector, std::map, or std::list, each with different performance trade-offs.

Exception

An object thrown to signal an error, which propagates up the call stack until a matching catch block handles it.

Stack Memory

Memory automatically managed in LIFO order as functions are called and return — fast, but limited in size and lifetime tied to scope.

Heap Memory

Memory manually (or smart-pointer) managed and allocated with new/malloc, living until explicitly freed — larger capacity, but slower and requires careful lifetime management.

Polymorphism

The ability to treat objects of different derived types uniformly through a common base type, typically via virtual functions.

Encapsulation

Bundling data and the functions that operate on it together, while restricting direct access to internal state (via private/protected).

Overloading

Defining multiple functions (or operators) with the same name but different parameter types, resolved at compile time based on the arguments used.

Overriding

A derived class providing its own implementation of a virtual function declared in a base class, resolved at runtime.

Segmentation Fault

A runtime crash caused by accessing memory the program isn’t allowed to touch, often from a dangling or invalid pointer.

Memory Leak

Heap memory that is allocated but never freed, remaining unreachable and wasted for the rest of the program’s lifetime.

Preprocessor

A text-substitution pass that runs before real compilation, handling directives like #include, #define, and #ifdef.

Object File

The compiled machine-code output of a single translation unit (.o or .obj), not yet linked into a final executable.