CKTIS / C++
unsigned long long — unsigned integer type
unsigned long long is a built-in unsigned integer type with at least 64 value bits. It stores nonnegative integers, and its arithmetic operates modulo 2^N. Its exact width depends on the implementation.
Version: C++23; repository compiler flag, production runtime not attested
Syntax
unsigned long long name = 0ULL;unsigned long long is a standard unsigned integer type; unsigned long long int names the same type. It has at least 64 value bits. For width N, its range is 0 through 2^N − 1 inclusive. Do not assume exactly 64 bits or sizeof(unsigned long long) == 8.
Declare a variable with unsigned long long count = 42ULL;. The ULL suffix gives a representable integer literal the type unsigned long long. Obtain the actual maximum value using std::numeric_limits<unsigned long long>::max() from <limits>.
Arithmetic of this type operates modulo 2^N: adding 1ULL to the maximum value produces 0. This is defined wrapping, not the undefined behavior of signed integer overflow. It can still indicate a program bug—an unsigned type does not replace range checks.
The example prints 42, then 0, regardless of the actual type width. The supplied source is an evolving standard draft, not a frozen C++23 publication; the rules described also apply to C++23.
Examples
#include <iostream>
#include <limits>
int main() {
unsigned long long count = 42ULL;
unsigned long long maximum =
std::numeric_limits<unsigned long long>::max();
unsigned long long wrapped = maximum + 1ULL;
std::cout << count << '\n' << wrapped << '\n';
}
Result
42 0
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.