Cloud Parts

C++

C with classes, templates and destructors: a language for writing abstractions that compile down to code as fast as hand-written C.

What it is
Programming languages (compiled to machine code)
Type
Open source
Made by
ISO/IEC JTC1/SC22/WG21
License
ISO standard (ISO/IEC 14882:2024); compilers carry their own licences
Facts checked
8 October 2026

What it is

C++ compiles to machine code and keeps C’s model of memory and hardware, then adds ways to build abstractions that cost nothing extra at run time. Its guiding rule is the zero-overhead principle: “what you don’t use, you don’t pay for”, and what you do use should be as fast as code you could write by hand. Classes have constructors and destructors, and RAII (Resource Acquisition Is Initialization) ties every resource, whether heap memory, a file, a socket or a lock, to the lifetime of an object, so the destructor releases it when the object goes out of scope, even when an exception unwinds the stack. Templates define families of classes and functions that the compiler stamps out for each type they are used with; the standard library’s containers and algorithms are built on them.

C++ is an ISO standard, written by the committee ISO/IEC JTC1/SC22/WG21 and implemented by independent compilers such as GCC and Clang. After C++98 and C++03, the committee moved to a three-year cycle: C++11 (rvalue references for move semantics, auto, lambdas, a threads library), C++14, C++17, C++20 (concepts, ranges, coroutines and modules) and C++23, published as ISO/IEC 14882:2024. A C++26 final draft followed in June 2026. Well-written C usually compiles as C++, which lets C++ code call C libraries directly, but it inherits C’s undefined behaviour and manual memory safety.

Why teams pick it

  • Abstractions without run-time cost: templates and inlining let generic code compile to what you would have written by hand
  • RAII makes cleanup automatic and exception-safe for every kind of resource, not just memory
  • Close to C: well-written C usually compiles as C++, and with no garbage collector it is the language of databases such as ClickHouse, DuckDB and RocksDB
  • An ISO standard with independent compilers and a new revision every three years since C++11

Watch out for

  • Not memory safe: dangling pointers and use-after-free are easy to write, and C and C++ pointer mistakes are behind about 70% of Chromium’s serious security bugs
  • A very large language: ISO C++ keeps compatibility with earlier C++ and, mostly, with C, so decades of features stay in
  • Slow builds: textual #include makes the compiler reread the same headers many times (one Google binary’s 4.2 MB of source became over 8 GB of compiler input in 2007); C++20 modules are an alternative to some uses of headers
  • No standard package manager or build system

Alternatives

What all compiled to machine code have in common →

How it fits with other technologies

One template for many types, and a file closed by its destructor · cpp

#include <fstream>
#include <iostream>
#include <string>
#include <vector>

template <typename T>
T total(const std::vector<T>& items) {  // one template, many types
    T sum{};
    for (const T& x : items) sum += x;
    return sum;
}

int main() {
    std::cout << total(std::vector<int>{1, 2, 3}) << '\n';           // 6
    std::cout << total(std::vector<double>{0.5, 0.25}) << '\n';      // 0.75
    std::cout << total(std::vector<std::string>{"a", "b"}) << '\n';  // ab

    {
        std::ofstream log("app.log");  // RAII: the constructor opens the file
        log << "started\n";
    }  // the destructor closes it here, even if an exception is thrown
}

See it in a real stack

No architecture uses C++ yet. Drop it into the playground and wire it up yourself.Open playground →
Where it came from1979–2024

In 1979 Bjarne Stroustrup, at Bell Labs, wanted to write efficient systems programs in the styles that Simula 67 encouraged, programs that would be both efficient and elegant. His specific task was distributing operating system facilities across a network. He added classes, better type checking and data abstraction to C, first through a preprocessor that turned “C with Classes” into C, then with a real compiler, Cfront, written in C with Classes.

The language was renamed C++ in late 1983, a name coined by Rick Mascitti, and the first commercial release came in October 1985 together with the first edition of The C++ Programming Language. Templates and exceptions followed later in the 1980s. ANSI and ISO committees formed in 1990 and 1991, the STL brought generic containers and algorithms in the 1990s, and the first ISO standard, C++98, was published in 1998.

After a long gap with only the C++03 bug-fix release, C++11 modernized the language, and since then WG21 has shipped a new standard every three years: C++14, C++17, C++20 and C++23.

Why it’s built this way

Build on C, not a new language
Stroustrup wanted compatibility with a complete language that already had the performance and flexibility for the most demanding systems work, and dreaded producing “yet-another pretty language with unintentional limitations”.
The zero-overhead principle
Many languages force a choice between efficient and elegant code. C++ promises that features you don’t use cost nothing, and that an abstraction used well is as fast as hand-written lower-level code.
Destructors and RAII
Tying resources to object lifetimes gives deterministic cleanup without a garbage collector, and makes code exception-safe: when an exception unwinds the stack, every fully built object is destroyed in reverse order.
Templates for generic code
Templates generate a specialized class or function per type at compile time, so a generic container or algorithm runs as fast as one written for a single type.

Timeline

  1. 1979

    Stroustrup starts “C with Classes” at Bell Labs

  2. 1983

    First used inside AT&T in August; renamed C++ late that year

  3. 1985

    First commercial release (Cfront 1.0) and The C++ Programming Language

  4. 1998

    C++98, the first ISO standard (ISO/IEC 14882:1998)

  5. 2011

    C++11 starts the modern era and a three-year release cycle

  6. 2020

    C++20 adds concepts, ranges, coroutines and modules

  7. 2024

    C++23 published as ISO/IEC 14882:2024

Sources17 · facts checked 8 October 2026

Improve this page on GitHub