What Is the C++ Standard Library C Library Interface?
C++ reaches the C standard library through the c-prefixed headers such as cstdio, and links C code with extern C. Learn the rules, pitfalls and alternatives.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
C++ reaches the C standard library through the c-prefixed headers such as cstdio, and links C code with extern C. Learn the rules, pitfalls and alternatives.
How std::system, std::exit, std::abort, std::atexit and std::getenv work in C++, what each skips during shutdown, and when to avoid them.
C++ has no timer class: you combine std::chrono clocks with sleep_until, timed waits and jthread. See the patterns for stopwatches, periodic work and timeouts.
C++ durations are part of std::chrono, not a separate library. See how duration types, literals, duration_cast and steady_clock work with runnable examples.
How to use std::chrono::time_point in C++: measure intervals, build deadlines, convert units and print dates, with modern C++17 and C++20 examples.
The C++ clocks library offers system_clock, steady_clock and C++20 utc, tai, gps and file clocks. See what each is for and how to pick the right one.
std::chrono is the C++ date and time library. See durations, time points, clocks, timing code, and the C++20 calendar and formatting additions with examples.
The C++ chrono library gives type-safe durations, time points and clocks, plus calendars and time zones in C++20. See how to use it with working examples.
std::ratio represents exact fractions as compile-time types. See how to add, compare and scale ratios, use SI prefixes, and how chrono depends on them.
The C++ tuple library, declared in <tuple>, provides std::tuple, a fixed-size container for values of different types. See how to create, read and unpack it.
std::format is the C++20 type-safe formatting library. See its syntax, specifiers, custom formatters and the C++23 std::println, with examples.
A practical guide to the C++ system error library: error codes, portable conditions, std::system_error exceptions and custom error categories.
C++ has no library called erroneous. Error handling uses the exception hierarchy, std::error_code and, in C++23, std::expected. See when to use each.
Use engines like std::mt19937 with distributions to generate random numbers in C++, replacing rand(). Covers seeding, thread safety and shuffling.
std::variant is the C++17 type-safe union. Learn to declare it, read it safely with get_if, and handle every alternative with std::visit and overloaded lambdas.
std::any holds one value of any copyable type and checks it at run time. See any_cast, make_any, error handling and how it compares with std::variant.
std::optional represents a value that may be absent without pointers or sentinels. See how to create, check and chain optionals, including C++23 monadic operations.
Allocators control how C++ containers get and release memory. See std::allocator, a minimal custom allocator and the C++17 pmr memory resources.
Learn how std::unique_ptr, std::shared_ptr and std::weak_ptr own heap objects, prevent leaks and dangling pointers, and which one to choose.
The C++ tuples library in <tuple> lets you group values of different types and unpack them again. Learn std::get, std::tie, std::apply and common pitfalls.