C++
Overview
C++ is a general-purpose programming language created by Bjarne Stroustrup as an extension of the C programming language. It was first developed at Bell Labs in the early 1980s under the name "C with Classes" and later renamed C++ in 1983. The language is designed to provide high performance, efficient use of hardware resources, and a rich set of abstractions including object-oriented, generic, and functional programming features.
C++ is widely used in systems programming, game development, real-time simulations, web browsers (e.g. Chromium), and large-scale server infrastructure. It is standardized by the International Organization for Standardization (ISO), with major versions including C++98, C++11, C++14, C++17, C++20, and C++23.
History
Bjarne Stroustrup began work on "C with Classes" in 1979 at Bell Labs, aiming to combine the efficiency and portability of C with the organizing benefits of Simula’s class mechanism. The first commercial release appeared in 1985, and the language was renamed C++ to emphasize the incremental advancement over C (the "++" operator incrementing the value).
The first ISO standard, C++98, was published in 1998. It defined the core language and the C++ Standard Library, including the Standard Template Library (STL). Subsequent revisions added library improvements and language features such as auto type deduction, range-based for loops, and variadic templates in C++11; generic lambdas and constexpr extensions in C++14; structured bindings, if constexpr, and fold expressions in C++17; and modules, coroutines, and concepts in C++20. C++23 introduced further library enhancements and refined language features.
Features
C++ supports multiple programming paradigms. Key features include:
- Object-oriented programming: classes, inheritance, polymorphism, and encapsulation.
- Generic programming: templates enable type-parameterized functions and classes, allowing code reuse without sacrificing performance.
- Low-level memory manipulation: pointers, references, and manual memory management, as well as the RAII (Resource Acquisition Is Initialization) idiom to manage resources safely.
- Standard Library: containers (e.g. vector, map), algorithms, input/output streams, smart pointers, and multithreading support.
- Compile-time computation: constexpr and consteval functions, templates, and the template metaprogramming capabilities.
- Exception handling: a mechanism to handle errors at runtime.
- Compatibility with C: C++ maintains a high degree of source and linkage compatibility with C, allowing the use of C libraries directly.