CKTIS / C++
std::uint32_t — exact-width 32-bit unsigned type
std::uint32_t from <cstdint> aliases an unsigned integer type with exactly 32 bits and no padding bits. It holds values from 0 through 4294967295. Whether the alias is available depends on the implementation.
Version: C++23; repository compiler flag, production runtime not attested
Syntax
#include <cstdint>
std::uint32_t value{42};std::uint32_t, declared in <cstdint>, aliases an existing unsigned integer type rather than introducing a new, distinct type. It has exactly 32 bits and no padding bits. Its inclusive value range is 0 through 4294967295.
This alias is optional: an implementation must provide it if it defines an integer type with the corresponding width and no padding bits. Do not assume it always means unsigned int. When you need at least 32 bits rather than exactly 32, consider std::uint_least32_t.
Arithmetic performed in a 32-bit unsigned type operates modulo 2^32. An integral conversion to std::uint32_t likewise produces the congruent value modulo 2^32, so static_cast<std::uint32_t>(-1) produces 4294967295. This does not mean every expression involving such an operand is evaluated in that type: integral promotions and conversions between types can change the computation type.
The example prints an ordinary value and the result of explicitly converting a negative integer. It covers rules available in C++23; the supplied source site presents an evolving working draft, not a frozen C++23 publication.
Examples
#include <cstdint>
#include <iostream>
int main() {
const std::uint32_t value{42};
const auto wrapped = static_cast<std::uint32_t>(-1);
std::cout << static_cast<unsigned long>(value) << '\n' << static_cast<unsigned long>(wrapped) << '\n';
}
Result
42 4294967295
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.