Program entry point: main
In a hosted environment, the global-scope main function is the entry point of a C++ program. It returns int, can receive startup arguments, and supplies the termination status.
CKTIS / C++
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
In a hosted environment, the global-scope main function is the entry point of a C++ program. It returns int, can receive startup arguments, and supplies the termination status.
RAII ties resource management to an object's lifetime: initialization establishes ownership, and the destructor releases the resource. A correctly designed owner therefore also performs cleanup during exception-driven stack unwinding.
A range exposes elements through a beginning iterator and an end sentinel. A view is a range with additional requirements that make it useful for building pipelines. The std::views::filter and std::views::transform adaptors select and transform elements without creating an intermediate result container.
A record groups named fields, usually in a struct. An aggregate is a formal C++ category that allows element initialization without a user-declared constructor. Not every struct is an aggregate.
Recursion means a function calls itself, directly or through other functions. For the computation to terminate, it needs a reachable base case and recursive steps that make progress toward that case.
A reduction combines a range into one result. Learn how std::accumulate, std::reduce, and std::transform_reduce differ, and calculate a mean and variance while accounting for accumulator types and operation order.
Scope determines the context for name lookup in source code, while lifetime describes an object's existence during execution. Hiding a name does not destroy its object. Storage duration is a separate, related concept.
A security boundary separates data or code with different levels of trust. In C++, private access control must not be confused with execution isolation: validating data before use is a separate responsibility, and undefined behavior does not guarantee safe program termination.
SFINAE allows a template overload to be discarded when argument substitution produces an invalid type or expression in the immediate context. It does not hide arbitrary template errors.
Correct sorting requires a comparator that defines a strict weak ordering. Binary search requires a range partitioned for the relevant condition; sorting the entire range is sufficient but not always necessary.
A C++ string stores elements, not ready-made user-visible characters. Learn the distinction between UTF-8 code units, Unicode code points, and grapheme clusters, and understand the roles of std::u8string and a u8 string literal.
Templates describe families of functions or types, while concepts state requirements on template arguments. The declaration template<Integer T> introduces a type parameter T constrained by Integer<T>, checked during compilation rather than at runtime.
Tests compare program behavior with expectations, while assertions express conditions that should hold. Learn property-based testing, idempotence, and a deterministic test corpus, plus the distinction between assert, static_assert, and checks that remain active when NDEBUG is defined.
std::chrono separates durations, time points, and calendar dates. Learn the %F and %R formats and the distinction between a fixed UTC offset and a named time zone.
Translation units let parts of a program be translated separately. Linkage determines name identity across declarations, while the ODR constrains the number and form of definitions. Distinguishing these concepts helps you split code correctly between headers and implementation files.
Type conversion adapts an expression to a required type. Learn implicit conversions, explicit static_cast conversions, integral promotions, and discarding a value with a cast to void.
The C++ type system defines the types of objects, references, functions, and expressions, together with permitted operations and conversions. Typing is static: auto deduces a type but does not let a variable change type later. Implicit conversions may be allowed even when they risk losing information.
A user-defined literal combines a numeric, character, or string literal with a custom suffix. Its literal operator turns that spelling into a value, such as an object representing a distance.
The categories lvalue, prvalue, and xvalue describe expressions, not kinds of variables. Learn their glvalue and rvalue groupings and how they relate to references, overload selection, and std::move, which does not itself transfer resources.
A variable lets a program store and refer to data of a particular type. Learn declarations, initialization, assignment, the roles of auto and const, and the distinction between a name's scope and an object's lifetime.
The objects std::execution::seq, std::execution::par, std::execution::par_unseq and std::execution::unseq specify how an algorithm is permitted to execute. They do not guarantee a speedup; choosing a policy also changes the requirements on functions that process elements.
The INT_MAX macro from <climits> specifies the largest int value for an implementation. Use it instead of hard-coding the limit, and check it before incrementing a value to avoid overflow.
Constants of type std::memory_order control synchronization and ordering for atomic operations. Learn how relaxed, release, acquire, acq_rel, and seq_cst differ, and how an atomic flag can safely publish ordinary data.
std::ignore is a standard-library object used with std::tie to skip selected elements during tuple assignment. It lets you store the values you need in existing variables without creating a dummy variable for the skipped element.