A three-bit declaration
C23 lets a declaration specify its width directly: unsigned _BitInt(3) u3 = 7wbu; signed _BitInt(3) s3 = 3wb;. The unsigned object represents values from 0 through 7, while the signed object represents values from -4 through 3. section 5.7.7
A bit-precise type is a C integer type whose width is specified in bits rather than selected from the usual standard integer widths. C23 introduces the _BitInt(N) syntax. Integer literals can use wb or WB, optionally combined with u or U; their type uses the least width that can represent the literal's value and signedness. section 5.7.7 section 5.3
Several rules determine how these types behave:
- Operations compute within the maximal operand width. Adding a three-bit unsigned value to a one-bit unsigned value therefore produces an unsigned _BitInt(3) result; a mathematical result of 8 wraps to 0. section 5.7.7
- Available widths run from 1 bit for unsigned types and 2 bits for signed types through BITINT_MAXWIDTH, defined in <limits.h>. section 5.7.7
- The maximum supported width is at least ULLONG_WIDTH, allowing exact-width constants beyond ordinary integer literal facilities when the implementation supports them. section 5.7.7
