Fixed-Width Types

Overview

Prior to C23, exact-width integer types were available. Since C23 bit-precise integer types have also been included.

Exact-Width

The <stdint.h> library contains exact-width integer types. These are aliases to types that represent an exact width and sign representation:

The C standard says these typedefs must be defined if they can be satisfied. Otherwise they may not exist.

Bit-Precise

Since C23, bit-precise integer types allow specifying quantities that should fit within a specified number of bits. The number of bits is provided as an argument to the _BitInt specifier.

Literal types may use case-insensitive suffix wb to specify signed bit-precise integer types. Likewise, case-insensitive suffix uwb specifies unsigned bit-precise integer types.

Since C23, additional bit operations have been made available in the <stdbit.h> header. These functions act on unsigned integer types.

Powered by Forestry.md