Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Knowledge base

Knowledge base

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

Entries: 5788

C++

friend — access for a nominated function or class

A friend declaration lets a nominated function or class access private and protected members without making it a member of the granting class.

Basic · C++23; repository compiler flag, production runtime not attested
C++

goto — unconditional jump to a label

The goto statement unconditionally transfers control to a named label in the same function. It can exit multiple nested loops, but remains subject to the rules for initializing and destroying local objects.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

if — conditional statement

The if statement selects a branch using a condition contextually converted to bool. Learn optional else branches, else if chains, initialization before the condition, and the distinction between ordinary if, if constexpr, and if consteval.

Basic · C++23; repository compiler flag, production runtime not attested
C++

import — importing modules and header units

`import` makes a named module's exported interface, a partition of the current module, or a header unit available. It does not textually paste contents like `#include`; importing a named module does not make macros available.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

inline — functions and variables defined in headers

inline allows function and variable definitions in headers while respecting the one-definition rule. It does not force call-site substitution or guarantee a faster program.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

module — module declarations

`module` specifies that a translation unit belongs to a named module or starts a module fragment. Distinguish `export module M;`, `module M;`, and `import M;`: they declare an interface, an implementation, and use of a module, respectively.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

mutable — modifiable members and lambdas

The mutable keyword allows a selected data member to change even in a const object. In a lambda it has a different role: it removes the call operator's default const qualification, allowing modification of modifiable copies of captured values.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

namespace — namespaces

The namespace keyword defines a namespace or a namespace alias. Namespaces group declarations and help distinguish identically named entities; qualified access takes the form N::name.

Basic · C++23; repository compiler flag, production runtime not attested
C++

noexcept — exception specification and operator

noexcept either declares that an exception cannot escape a function or checks at compile time whether an expression is potentially throwing. These two uses combine in the conditional specification noexcept(noexcept(expression)).

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

not — alternative spelling of logical negation

`not` is an alternative spelling of the `!` operator in C++. The built-in operator reverses its operand's truth value and returns `bool`. It is neither bitwise negation nor a separate library function.

Basic · C++23; repository compiler flag, production runtime not attested
C++

not_eq — alternative spelling of the inequality operator

`not_eq` is a language-level alternative spelling of the C++ operator `!=`. It compares two operands using the same rules, precedence, and associativity; it requires neither a header nor a macro.

Basic · C++23; repository compiler flag, production runtime not attested
C++

nullptr — the null pointer literal

nullptr is a null pointer constant with the distinct type std::nullptr_t. Use it to initialize and compare pointers instead of the numeric literal 0, especially when calling overloaded functions.

Basic · C++23; repository compiler flag, production runtime not attested
C++

operator — operator overloading and conversion functions

The operator keyword forms names for overloaded operator functions, conversion functions, and literal operators. It lets you define how operations work on your own types, without changing operator precedence or grouping.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

or — alternative spelling of logical OR

`or` is a language-level alternative spelling of the C++ operator `||`. For the built-in operator, the result is `bool`, and the right operand is evaluated only when the left operand is `false`. Do not confuse it with bitwise OR: `|` or `bitor`.

Basic · C++23; repository compiler flag, production runtime not attested
C++

or_eq — bitwise OR assignment

`or_eq` is an alternative spelling of the C++ `|=` operator. It combines the operands' bits using OR and stores the result in the left operand. It is a reserved language token, not a macro, and requires no header.

Basic · C++23; repository compiler flag, production runtime not attested
C++

override — checking virtual function overriding

override requires a member function to override a virtual function from a base class. It catches declaration mistakes during compilation instead of allowing an inherited function to be hidden accidentally.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

private — private member access and inheritance

The private keyword restricts access to class members to the class's members and friends. In a base clause, it specifies private inheritance. This is a program correctness check, not a memory-security boundary.

Basic · C++23; repository compiler flag, production runtime not attested
C++

protected — protected access

The protected keyword controls member access or inheritance access. It makes members available to derived classes without exposing them to ordinary outside code, but adds restrictions on the object expression used to access non-static members.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

public — public access and public inheritance

The public keyword specifies public access to class members or public inheritance. A public: section exposes a class interface, while : public Base preserves the public and protected access levels of base-class members.

Basic · C++23; repository compiler flag, production runtime not attested
C++

register — reserved keyword after removal of the specifier

In C++23, register remains a reserved keyword but is not a permitted storage-class specifier. Its former use in declarations was removed in C++17; migration usually only requires removing register.

Basic · C++23; repository compiler flag, production runtime not attested
C++

requires — constraints and requirement checking

The requires keyword introduces either a clause constraining a declaration or an expression checking requirements on types and operations. Distinguishing these uses helps you write templates whose availability depends on the capabilities of the supplied type.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

return — ending a function and returning a result

The return statement ends the current function call and transfers control to its caller. It can also initialize a returned value or reference. It is not equivalent to break: inside a loop, it exits the entire function.

Basic · C++23; repository compiler flag, production runtime not attested
C++

signed — signed integer type specifier

The signed keyword specifies a signed integer type. Used alone, signed means int; with short, int, long, and long long it is redundant. However, signed char is a distinct type from both char and unsigned char.

Basic · C++23; repository compiler flag, production runtime not attested
C++

static — persistent state, internal linkage, and class members

The meaning of static depends on the declaration's location: a local variable retains state between calls, a namespace-scope name gets internal linkage, and a class member does not require a separate copy in every object. Storage duration, scope, and linkage are different concepts.

Intermediate · C++23; repository compiler flag, production runtime not attested