keyword:
auto: "**`auto`** — deduce this declaration's type from its initializer.\n\nThe type is the one the initializer has, with top-level `const` and references dropped: `const int& r = x; auto v = r;` makes `v` an `int`. `auto&`/`const auto&` keep them."
bool: "**`bool`** — `true` or `false`.\n\nConvertible to and from `int` (`false` is 0, `true` is 1), but the conversion is not what the type means: a `bool` parameter documents a yes-or-no answer, and an `int` one does not."
break: "**`break`** — leave the nearest enclosing `for`, `while`, `do` or `switch`.\n\nThe loop is left entirely, not just the current iteration — `continue` is the one for that."
case: "**`case`** — a label in a `switch`.\n\nThe labels are compared against the switched value, and a case that falls into the next one without a `break` is a real spelling (`case 'a': case 'b':`), not a mistake in C++."
catch: "**`catch`** — handle an exception thrown by the matching `try` block.\n\nA `catch (...)` takes anything; `catch (const std::exception& e)` is the ordinary spelling, because catching by value slices the exception."
char: "**`char`** — one byte, whose signedness is the implementation's.\n\nUse it for characters. For bytes use `unsigned char`/`std::byte`, and for arithmetic `int8_t`/`uint8_t`."
class: "**`class`** — a user-defined type whose members are **private** by default.\n\nThe only difference from `struct` is that default access plus the default kind of inheritance."
co_await: "**`co_await e`** — suspend this coroutine until `e` is ready, and take the value its awaiter produces.\n\n`e` is an *awaitable*: it declares `await_ready()`, `await_suspend(handle)` and `await_resume()`. The whole expression has `await_resume()`'s return type, and the coroutine suspends when `await_ready()` answers false."
co_return: "**`co_return [e]`** — finish a coroutine, handing the value to its promise.\n\nWriting this (or `co_await`/`co_yield`) is what makes the function a coroutine. The promise's `return_value(e)` receives it — `return_void()` when there is none — and the declared return type is the coroutine's *handle* type (`task<T>`, `generator<T>`), not `T`."
co_yield: "**`co_yield e`** — suspend this coroutine and produce `e`.\n\nThe promise's `yield_value(e)` receives it and chooses how to suspend (usually `std::suspend_always`); the function's return type is a generator-like type whose `promise_type` declares `yield_value`."
const: "**`const`** — this name cannot be modified through this declaration.\n\nOn a pointer it may qualify the pointee (`const int*`) or the pointer (`int* const`) — the `*` decides which."
constexpr: "**`constexpr`** — the value or function may be evaluated at compile time.\n\nOn a variable it also implies `const`. On a function it is a license for the compiler, not a requirement: a `constexpr` function is still callable at runtime."
consteval: "**`consteval`** — this function must be evaluated at compile time.\n\nUnlike `constexpr`, a call that cannot be evaluated at compile time is an error."
constinit: "**`constinit`** — this variable is initialized at compile time, but is not `const`.\n\nIt rules out static initialization order problems without taking away the ability to modify the value."
continue: "**`continue`** — end this iteration of the nearest enclosing loop, and go on to the next."
decltype: "**`decltype(expr)`** — the type this expression has, exactly as declared.\n\n`decltype((x))` on a variable is `T&` while `decltype(x)` is `T` — the parentheses are part of the question."
default: "**`default`** — the other label of a `switch`, or the member this declaration asks the compiler to write (`= default`)."
delete: "**`delete`** — destroy an object created by `new`, or mark a function as unavailable (`= delete`).\n\n`delete[]` is for an array allocated by `new[]`; pairing them wrongly is undefined behaviour."
do: "**`do` … `while (cond);`** — a loop whose body runs before the condition is read, so it runs at least once."
else: "**`else`** — the branch taken when the `if` condition was false."
enum: "**`enum`** — a distinct type whose values are named constants.\n\n`enum class E` scopes the names (`E::V`) and does not convert to `int`; a plain `enum E` does both, which is what it means to write."
explicit: "**`explicit`** — this constructor does not participate in implicit conversions, and this conversion operator is not applied implicitly.\n\n`explicit(false)` in C++20 spells the opposite when a condition decides it."
extern: "**`extern`** — the name is defined in another translation unit (`extern int n;`), or the block has C linkage (`extern \"C\" { … }`)."
false: "**`false`** — the `bool` value 0."
float: "**`float`** — a single-precision floating-point number, usually 32 bits.\n\nFor arithmetic where precision matters, `double` is the default choice in C++."
for: "**`for`** — a counted loop (`for (init; cond; step)`), a range loop (`for (T x : range)`), or a fold expression in a template."
friend: "**`friend`** — this declaration may reach the non-public members of the class it is written in.\n\nFriendship is granted, never taken, and it is not inherited."
goto: "**`goto`** — continue at a label in this function.\n\nIt may not jump over an initialization, which is why it is rare outside generated code and clean-up blocks."
if: "**`if`** — run a statement when the condition is true.\n\nSince C++17 the condition may hold an initializer: `if (auto it = m.find(k); it != m.end())`."
inline: "**`inline`** — this function or variable may be defined in several translation units.\n\nOn a function in a header it also hints at inlining, which the compiler may ignore; on a variable it is what makes a header-level definition legal (or `inline constexpr`)."
mutable: "**`mutable`** — this member may be modified even in a `const` member function.\n\nFor caches and locks, not for state a reader would call part of the value."
namespace: "**`namespace`** — a scope for names.\n\nA named namespace may be reopened anywhere; an anonymous one is unique to its translation unit, which is what `static` used to mean at file scope."
noexcept: "**`noexcept`** — this function promises not to let an exception out.\n\nBreaking the promise calls `std::terminate`; the promise is also part of the type and of overload resolution (`void f() noexcept` and `void f()` are different types)."
nullptr: "**`nullptr`** — the null pointer literal, of type `std::nullptr_t`.\n\nUnlike `0` or `NULL` it converts to any pointer type and to no integer type, which is what makes overload problems disappear."
operator: "**`operator`** — this function defines what an operator means for a type (or performs an explicit conversion)."
private: "**`private`** — the members after it are reachable only from this class (and its friends)."
protected: "**`protected`** — the members after it are reachable from this class, its derived classes, and its friends."
public: "**`public`** — the members after it are reachable from anywhere."
register: "**`register`** — a storage-class hint that the variable be kept in a register.\n\nDeprecated since C++11 and removed in C++17; it is accepted for compatibility."
return: "**`return`** — leave the function, producing this value (or none, in a `void` function).\n\n`return {1, 2};` and `return T{…};` construct the result directly instead of copying one."
short: "**`short`** — a signed integer at least 16 bits wide (usually exactly 16)."
signed: "**`signed`** — the signed version of the following integer type; `signed` alone is `int`."
sizeof: "**`sizeof`** — the size of a type or expression in bytes, as a `size_t`, with no evaluation of the expression."
static: "**`static`** — at file scope: this name has internal linkage; in a function: one object shared by every call; in a class: the member belongs to the class, not to an object."
static_assert: "**`static_assert`** — a condition checked when the program is compiled.\n\nThe message is the second argument since C++17 (`static_assert(sizeof(T) == 4, \"T must be 4 bytes\")`)."
static_cast: "**`static_cast<T>(x)`** — a conversion checked by the compiler, with no runtime test.\n\nThe conversion a reader expects: `double` to `int`, a pointer up the hierarchy, `void*` back to a typed pointer."
struct: "**`struct`** — a user-defined type whose members are **public** by default, and which inherits publicly by default."
switch: "**`switch`** — choose a `case` by comparing the value.\n\nA `break` ends each branch; without one the next case runs too, which is occasionally what the code means."
template: "**`template`** — this declaration is a pattern, instantiated with the arguments a use names."
this: "**`this`** — a pointer to the object a member function was called on; `*this` is the object itself.\n\nIn a `const` member function it is `const T*`, which is why a non-const member cannot be called from one."
throw: "**`throw`** — raise an exception, and end the function as it leaves.\n\n`throw;` re-throws the exception being handled; `noexcept` functions must not throw."
true: "**`true`** — the `bool` value 1."
try: "**`try`** — the block whose exceptions the `catch` handlers below may handle.\n\nA function-try-block also catches exceptions thrown by member initializers."
typedef: "**`typedef`** — an alias for a type, spelled `typedef T Name;`.\n\n`using Name = T;` is the same thing in a form that reads left to right and works for templates."
typename: "**`typename`** — the following qualified name is a type (a dependent name in a template), or this template parameter is a type."
union: "**`union`** — a type whose members share one storage.\n\nReading a member other than the one last written is undefined behaviour except for a common initial sequence; C++17 adds `std::variant` for the safe form."
unsigned: "**`unsigned`** — the unsigned version of the following integer type; `unsigned` alone is `unsigned int`.\n\nUnsigned arithmetic wraps and never overflows, which is why `i < v.size()` on a signed `i` is a real bug."
using: "**`using`** — a type alias (`using Name = T;`), a using-declaration (`using ns::f;`), a using-directive (`using namespace ns;`), or a using-enum."
virtual: "**`virtual`** — this member function may be overridden by a derived class, and the call resolves to the object's dynamic type.\n\n`virtual` plus `= 0` makes the class abstract."
void: "**`void`** — the type with no values: a function that returns nothing, or a `void*` that points to something untyped."
volatile: "**`volatile`** — every access to this object is a real read or write, which is what hardware registers and `sig_atomic_t` need.\n\nIt is not a tool for synchronization between threads; use atomics."
while: "**`while`** — a loop that tests its condition before each iteration."
inline_namespace: "**`inline namespace`** — a namespace whose names are visible in the enclosing one, which is how a library versions its ABI without breaking source compatibility."
command:
brief: "**`@brief`** — the one-line summary of the documented entity.\n\nWritten as `@brief text`, or as the first paragraph without a command."
short: "**`@short`** — a short description; a synonym for `@brief`."
details: "**`@details`** — the long description, after the brief."
return: "**`@return`** — what the function returns.\n\nWrite what the value *means*, and the conditions under which it is produced."
returns: "**`@returns`** — a synonym for `@return`."
result: "**`@result`** — a synonym for `@return`."
param: "**`@param`** — document one parameter: `@param name description`.\n\nA direction may be written as `@param[in]`, `@param[out]`, `@param[in,out]`, and Doxygen then checks that every parameter is documented."
tparam: "**`@tparam`** — document one template parameter: `@tparam T description`."
exception: "**`@exception`** — document an exception this function may throw: `@exception Type when`."
throws: "**`@throws`** — a synonym for `@exception`."
note: "**`@note`** — something the reader must know, set apart from the description."
warning: "**`@warning`** — a hazard: what will go wrong, and when."
attention: "**`@attention`** — a call for care; a stronger `@note`."
deprecated: "**`@deprecated`** — this entity is obsolete.\n\nSay what replaces it: the popup is the one place a reader learns where to go instead."
since: "**`@since`** — the version this entity appeared in."
see: "**`@see`** — a cross-reference to another entity, by name or by `#member`."
sa: "**`@sa`** — a synonym for `@see`."
ref: "**`@ref`** — a link to another documented entity, `@ref Item \"text\"`."
file: "**`@file`** — this comment documents the file, not the declaration after it."
author: "**`@author`** — who wrote this."
date: "**`@date`** — when this was written or changed."
version: "**`@version`** — the version of this entity."
copyright: "**`@copyright`** — the licence this is under."
todo: "**`@todo`** — something still to be done."
bug: "**`@bug`** — a known defect, described where the code is."
test: "**`@test`** — what the tests for this entity check."
example: "**`@example`** — a file that is an example of this entity's use."
code: "**`@code`** — the following lines are code until `@endcode`.\n\nKept verbatim, so indentation and comments inside survive."
endcode: "**`@endcode`** — ends the block opened by `@code`."
verbatim: "**`@verbatim`** — the following lines are kept exactly as written, until `@endverbatim`."
endverbatim: "**`@endverbatim`** — ends the block opened by `@verbatim`."
pre: "**`@pre`** — a precondition: what must be true before the call."
post: "**`@post`** — a postcondition: what the call guarantees afterwards."
invariant: "**`@invariant`** — what stays true for the lifetime of the object."
group: "**`@group`** — add this entity to a named group of related documentation."
ingroup: "**`@ingroup`** — this entity belongs to an existing group."
name: "**`@name`** — starts a member group with this title; `@{` … `@}` bound it."
namespace: "**`@namespace`** — this comment documents a namespace."
class: "**`@class`** — this comment documents a class, when it cannot be written next to it."
struct: "**`@struct`** — this comment documents a struct."
enum: "**`@enum`** — this comment documents an enumeration."
fn: "**`@fn`** — this comment documents a function, when it cannot be written next to it."
var: "**`@var`** — this comment documents a variable."
def: "**`@def`** — this comment documents a `#define`."
typedef: "**`@typedef`** — this comment documents a type alias."
mainpage: "**`@mainpage`** — the text of the documentation's front page."
section: "**`@section`** — starts a named section: `@section intro Introduction`."
subsection: "**`@subsection`** — a section inside a section."
page: "**`@page`** — starts a standalone page of documentation."
internal: "**`@internal`** — this entity is not part of the public interface.\n\nExcluded when `INTERNAL_DOCS` is off, which is what makes it the right marker for implementation notes."
public: "**`@public`** — explicitly part of the public interface."
private: "**`@private`** — explicitly implementation detail."
cond: "**`@cond`** — the following documentation is included only when the named condition is set, until `@endcond`."
endcond: "**`@endcond`** — ends the block opened by `@cond`."
dot: "**`@dot`** — the following lines are a graphviz `dot` graph, until `@enddot`."
enddot: "**`@enddot`** — ends the block opened by `@dot`."
image: "**`@image`** — an image in the documentation: `@image html file.png \"caption\"`."
li: "**`@li`** — one item of a list."
arg: "**`@arg`** — one item of a list, as `@li`."
doc:
returns: "Returns"
note: "Note"
warning: "Warning"
attention: "Attention"
see: "See also"
deprecated: "Deprecated"
todo: "Todo"
parameter: "Parameter"
cuda:
__global__: "**`__global__`** — a kernel: called from the host, run on the device.\n\nA kernel returns `void`, is launched with `kernel<<<grid, block>>>(args)`, and runs **once per thread** of that configuration: the same function body is every thread's body. Inside it, `threadIdx`, `blockIdx`, `blockDim` and `gridDim` say which thread this is.\n\nIt cannot be a class member, and it cannot be called like a function — the launch brackets are the call."
__device__: "**`__device__`** — runs on the device: callable from a kernel or from another `__device__` function.\n\nA function with no qualifier is `__host__` and runs on the CPU. On a member function `__device__` is a qualifier on the function, and the class may then be used from device code."
__host__: "**`__host__`** — runs on the host: an ordinary function, compiled for the CPU.\n\nIt is the default, so it is written only where the other two are: `__host__ __device__` means both bodies are compiled, and the compiler picks at each call site."
__shared__: "**`__shared__`** — a block-wide scratch array in shared memory.\n\nShared memory is on the multiprocessor, so every thread of a block reads it in a few cycles; it is not shared between blocks. A block's `__shared__` array is one array for the whole block, and every thread that touches it must agree on which element — the `threadIdx`-based indexing is the point of it.\n\nDeclared inside the kernel, with a size the compiler must know at launch time: `__shared__ float tile[16][16];`."
__constant__: "**`__constant__`** — read-only device memory, written by the host before the launch.\n\nCached and broadcast: every thread of a warp reading the same address costs one read. A kernel parameter is the same thing without a declaration, which is why small arguments are passed rather than copied."
__managed__: "**`__managed__`** — memory reachable from both the host and the device, migrated on demand.\n\nA global variable with this qualifier may be written on either side; CUDA moves the pages. Convenient for a small table, and slower than deciding on one side."
__grid_constant__: "**`__grid_constant__`** — a kernel parameter that every thread reads, not one copy per thread.\n\nWithout it a large parameter is copied into each thread's stack; with it the grid sees one object, read-only."
__restrict__: "**`__restrict__`** — no aliasing through this pointer, as C's `restrict`.\n\nA promise that nothing else writes through another name, which lets the compiler reorder and vectorise loads. A promise that turns out to be false is undefined behaviour."
__launch_bounds__: "**`__launch_bounds__(maxThreadsPerBlock[, minBlocksPerMultiprocessor])`** — the launch shape a kernel is compiled for.\n\nIt constrains registers and unrolling: `__launch_bounds__(1024)` says no block will be larger than 1024 threads, so the compiler may spend fewer registers per thread; the second argument asks for at least that many resident blocks."
__maxnreg__: "**`__maxnreg__(n)`** — the most registers one thread of this kernel may use.\n\nLower means more resident blocks and more spills; it is a tuning knob, not a correctness one."
__align__: "**`__align__(n)`** — the alignment of a declaration, as `alignas` is to C++.\n\nWorth writing for a structure the toolkit copies: a misaligned vector load is slow and, in some paths, illegal."
__cluster_dims__: "**`__cluster_dims__(x, y, z)`** — the shape of the thread-block cluster this kernel is launched in.\n\nA cluster is a group of blocks that may share distributed shared memory; on hardware without clusters the qualifier is a compile-time error."
__forceinline__: "**`__forceinline__`** — always inline this function, as `inline` meant before C++17 relaxed it."
__noinline__: "**`__noinline__`** — never inline this function.\n\nUseful to keep a device function out of a hot kernel's register budget."
threadIdx: "**`threadIdx`** — the index of this thread within its block, a `dim3`.\n\nThe one value a kernel reads first: `unsigned i = threadIdx.x + blockIdx.x * blockDim.x;` is the flat index of this thread in the grid. `.y` and `.z` exist because a block may be launched two- or three-dimensional."
blockIdx: "**`blockIdx`** — the index of this block within the grid, a `dim3`.\n\nBounds-check it before it is used to index: `if (blockIdx.x < n)` is what keeps a grid whose last block is partly idle from reading past the array."
blockDim: "**`blockDim`** — the number of threads in this block, a `dim3`.\n\nIt is the `block` half of the launch configuration: `kernel<<<2, 128>>>` gives every block a `blockDim.x` of 128."
gridDim: "**`gridDim`** — the number of blocks in the grid, a `dim3` — the `grid` half of the launch configuration."
warpSize: "**`warpSize`** — the number of threads in a warp: 32 on every NVIDIA GPU so far.\n\nA device function may read it; a kernel that assumes 32 is right about today's hardware and wrong about the day it changes, which is why `warpSize` is the spelling to use."
dim3: "**`dim3`** — three unsigned components, `.x .y .z`, defaulting to 1.\n\nIt is what a launch is configured with: `kernel<<<dim3(2, 1), 128>>>` means two blocks in `x` and 128 threads per block. A plain `128` is a `dim3(128, 1, 1)`."
__half: "**`__half`** — a 16-bit floating-point value, declared by `cuda_fp16.h`.\n\nHalf the memory of a `float` and the arithmetic the tensor cores want; on the host side the same type is `_Float16` or a library type, so it is mostly a device type."
__half2: "**`__half2`** — two `__half` values packed in one 32-bit word, with arithmetic on both at once (`cuda_fp16.h`)."
__nv_bfloat16: "**`__nv_bfloat16`** — a 16-bit brain float: an 8-bit exponent like `float` and a 7-bit mantissa (`cuda_bf16.h`).\n\nChosen over `__half` for the range rather than the precision: it needs no loss scaling."
vector_char: "**`char1`, `char2`, `char3`, `char4`** — one to four signed 8-bit integers, with components `.x`, `.y`, `.z`, `.w`.\n\nThe numbered families are the toolkit's vector types: they are what a kernel's memory accesses are aligned to, and what a texture or a `float4` copy moves in one instruction. `3` is padded to four components in memory, which is why an array of `char3` costs what an array of `char4` does."
vector_uchar: "**`uchar1` … `uchar4`** — one to four unsigned 8-bit integers, components `.x` … `.w`."
vector_short: "**`short1` … `short4`** — one to four signed 16-bit integers, components `.x` … `.w`."
vector_ushort: "**`ushort1` … `ushort4`** — one to four unsigned 16-bit integers, components `.x` … `.w`."
vector_int: "**`int1` … `int4`** — one to four signed 32-bit integers, components `.x` … `.w`.\n\n`int4` is 16 bytes: one vector load, which is the reason to reach for it."
vector_uint: "**`uint1` … `uint4`** — one to four unsigned 32-bit integers, components `.x` … `.w`."
vector_long: "**`long1` … `long4`** — one to four `long`s, components `.x` … `.w`.\n\nThe width is the platform's: 32 bits on Windows, 64 on Linux. `longlong` is the spelling that is always 64."
vector_ulong: "**`ulong1` … `ulong4`** — one to four `unsigned long`s, components `.x` … `.w`."
vector_longlong: "**`longlong1` … `longlong4`** — one to four signed 64-bit integers, components `.x` … `.w`."
vector_ulonglong: "**`ulonglong1` … `ulonglong4`** — one to four unsigned 64-bit integers, components `.x` … `.w`."
vector_float: "**`float1` … `float4`** — one to four 32-bit floats, components `.x` … `.w`.\n\n`float4` is the workhorse of a memory-bound kernel: 16 aligned bytes per thread per access, which is what the hardware likes best."
vector_double: "**`double1` … `double4`** — one to four 64-bit floats, components `.x` … `.w`.\n\nThe device that computes in `double` does it at a fraction of the `float` rate except on its dedicated units; the type is here because a kernel that needs exact arithmetic needs it."