Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C++

Knowledge base — C++

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 674

C++

Aligned allocation overload matching

Learn how C++23 selects class-specific `operator new` and `operator delete` overloads and why the paired global calls must receive the same alignment value.

Advanced · ISO C++23; implementation support may vary
C++

The C++ array declarator (`[]`)

The `[]` declarator forms a built-in array type. The bound can be part of the array type, but array syntax in a function parameter does not pass a length.

Advanced · ISO C++23; implementation support may vary
C++

Array of structures (AoS) in C++

AoS stores complete records side by side, whereas SoA groups each field into its own array. Which layout fits depends on how the program accesses the data.

Advanced · ISO C++23; implementation support may vary
C++

assert and NDEBUG: runtime checks you can disable

`assert` checks an internal program assumption at runtime. Defining `NDEBUG` can disable the check without evaluating its condition; it does not affect `static_assert`.

Intermediate · ISO C++23; implementation support may vary
C++

Automatic storage duration versus dynamic allocation

Distinguish an object’s storage duration and lifetime from any separate allocations made by its members, such as storage for a `std::string`’s characters.

Advanced · ISO C++23; implementation support may vary
C++

Cache locality in C++: AoS and SoA

Choose a data layout based on what the program actually reads. AoS groups the fields of a record; SoA groups values of the same field across records.

Advanced · ISO C++23; implementation support may vary
C++

Capture by copy in C++ lambdas

Capture a threshold by value so the predicate keeps using it even when the original variable changes.

Advanced · ISO C++23; implementation support may vary
C++

C language linkage: `extern "C"`

`extern "C"` specifies language linkage for interoperability between C and C++. It does not switch the compiler to C or guarantee binary compatibility on its own.

Advanced · ISO C++23; implementation support may vary
C++

Copy elision and NRVO in C++

Returning by value does not necessarily copy an object. Distinguish optional NRVO for a named local from guaranteed direct construction from a same-type prvalue.

Advanced · ISO C++23; implementation support may vary
C++

Formatting numbers with cout.setf and setprecision(2)

Set `std::cout` to fixed-point notation with two digits after the decimal separator. Learn why the `floatfield` mask matters and how to restore the previous format.

Intermediate · ISO C++23; implementation support may vary
C++

C-style ellipsis fallback

A standalone ellipsis in `test(...)` provides a fallback overload when a typed probe cannot match. It is not a template parameter pack or pack expansion.

Advanced · ISO C++23; implementation support may vary
C++

Data-oriented design: AoS, SoA, and cache locality

Choose a layout around how your program uses its data: compare whole records with separate columns, then measure the effect on a representative workload.

Advanced · ISO C++23; implementation support may vary
C++

`= default` — explicitly defaulted functions in C++

`= default` asks the compiler to supply the standard definition of an eligible function. Ownership, PImpl, and virtual destructors show where this matters.

Advanced · ISO C++23; implementation support may vary
C++

Using `= default` on a virtual destructor

Declare a public virtual base-class destructor so a derived object can be deleted through a base pointer without writing a destructor body for the base class.

Intermediate · ISO C++23; implementation support may vary
C++

Defaulted special member functions (`= default`) in C++

In C++23, `= default` asks the compiler for the standard definition of a special member function. Definition placement matters in Pimpl; C++23 implementation support may vary.

Advanced · ISO C++23; implementation support may vary
C++

`= delete`: deleted functions and exclusive ownership

`= delete` forbids use of a function at compile time. A coroutine frame owner can use it to forbid copying while still transferring ownership by moving and releasing the frame in its destructor.

Advanced · ISO C++23; implementation support may vary
C++

Deleted function (`= delete`)

Reject a specific overload or prevent copying at compile time while keeping a class movable and handling destruction of its hidden implementation correctly.

Advanced · ISO C++23; implementation support may vary
C++

Deleted functions (`= delete`) in C++

`= delete` makes a specific function unusable at compile time. Use it to reject an unwanted overload or to prevent an owning pool from being copied or moved.

Advanced · ISO C++23; implementation support may vary