Lesson content
Read, practise, then check your understanding
C++ began as Bjarne Stroustrup’s “C with Classes” at Bell Labs in 1979 and became C++ in 1983. ISO standardization started with C++98 and evolved through C++11, C++14, C++17, C++20, and C++23. Modern C++ supports procedural, object-oriented, generic, and functional styles while retaining efficient access to hardware.
Toolchain and first build
Install GCC, Clang, or MSVC and use a recent language mode. Enable warnings because they catch many type, lifetime, and control-flow mistakes.
#include <iostream>
int main() {
std::cout << "Hello, modern C++!\n";
}
With GCC or Clang, build with c++ -std=c++20 -Wall -Wextra -Wpedantic main.cpp -o app. A project normally moves through preprocessing, compilation, assembly, and linking. Debuggers, sanitizers, formatters, and a build system such as CMake complete the practical setup.
C and C++ are different languages
C++ inherited much of C syntax, but idiomatic C++ uses constructors, destructors, references, templates, exceptions, containers, algorithms, and RAII. Prefer std::string to manual character buffers, std::vector to owning dynamic arrays, and smart pointers to owning raw pointers. C-style casts, malloc, and global mutable state may compile but bypass useful C++ guarantees.
The zero-overhead goal
C++ abstractions are designed so unused features cost nothing and well-designed abstractions can compile to code comparable with a manual implementation. Performance is not automatic: undefined behavior, needless allocation, poor data layout, and accidental copies still matter. Start with clear ownership and strong types, test behavior, then profile before optimizing.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.