Files
2025-10-25 03:02:53 +03:00

53 lines
5.2 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[cstdint.syn]
# 17 Language support library [[support]](./#support)
## 17.4 Arithmetic types [[support.arith.types]](support.arith.types#cstdint.syn)
### 17.4.1 Header <cstdint> synopsis [cstdint.syn]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L1880)
The header [<cstdint>](#header:%3ccstdint%3e "17.4.1Header <cstdint> synopsis[cstdint.syn]") supplies integer types having specified widths, and
macros that specify limits of integer types[.](#1.sentence-1)
[🔗](#header:%3ccstdint%3e)
// all freestanding#define __STDC_VERSION_STDINT_H__ 202311Lnamespace std {using int8_t = *signed integer type*; // optionalusing int16_t = *signed integer type*; // optionalusing int32_t = *signed integer type*; // optionalusing int64_t = *signed integer type*; // optionalusing int*N*_t = *see below*; // optionalusing int_fast8_t = *signed integer type*; using int_fast16_t = *signed integer type*; using int_fast32_t = *signed integer type*; using int_fast64_t = *signed integer type*; using int_fast*N*_t = *see below*; // optionalusing int_least8_t = *signed integer type*; using int_least16_t = *signed integer type*; using int_least32_t = *signed integer type*; using int_least64_t = *signed integer type*; using int_least*N*_t = *see below*; // optionalusing intmax_t = *signed integer type*; using intptr_t = *signed integer type*; // optionalusing uint8_t = *unsigned integer type*; // optionalusing uint16_t = *unsigned integer type*; // optionalusing uint32_t = *unsigned integer type*; // optionalusing uint64_t = *unsigned integer type*; // optionalusing uint*N*_t = *see below*; // optionalusing uint_fast8_t = *unsigned integer type*; using uint_fast16_t = *unsigned integer type*; using uint_fast32_t = *unsigned integer type*; using uint_fast64_t = *unsigned integer type*; using uint_fast*N*_t = *see below*; // optionalusing uint_least8_t = *unsigned integer type*; using uint_least16_t = *unsigned integer type*; using uint_least32_t = *unsigned integer type*; using uint_least64_t = *unsigned integer type*; using uint_least*N*_t = *see below*; // optionalusing uintmax_t = *unsigned integer type*; using uintptr_t = *unsigned integer type*; // optional}#define INT*N*_MIN *see below*#define INT*N*_MAX *see below*#define UINT*N*_MAX *see below*#define INT*N*_WIDTH *see below*#define UINT*N*_WIDTH *see below*#define INT_FAST*N*_MIN *see below*#define INT_FAST*N*_MAX *see below*#define UINT_FAST*N*_MAX *see below*#define INT_FAST*N*_WIDTH *see below*#define UINT_FAST*N*_WIDTH *see below*#define INT_LEAST*N*_MIN *see below*#define INT_LEAST*N*_MAX *see below*#define UINT_LEAST*N*_MAX *see below*#define INT_LEAST*N*_WIDTH *see below*#define UINT_LEAST*N*_WIDTH *see below*#define INTMAX_MIN *see below*#define INTMAX_MAX *see below*#define UINTMAX_MAX *see below*#define INTMAX_WIDTH *see below*#define UINTMAX_WIDTH *see below*#define INTPTR_MIN *see below* // optional#define INTPTR_MAX *see below* // optional#define UINTPTR_MAX *see below* // optional#define INTPTR_WIDTH *see below* // optional#define UINTPTR_WIDTH *see below* // optional#define PTRDIFF_MIN *see below*#define PTRDIFF_MAX *see below*#define PTRDIFF_WIDTH *see below*#define SIZE_MAX *see below*#define SIZE_WIDTH *see below*#define SIG_ATOMIC_MIN *see below*#define SIG_ATOMIC_MAX *see below*#define SIG_ATOMIC_WIDTH *see below*#define WCHAR_MIN *see below*#define WCHAR_MAX *see below*#define WCHAR_WIDTH *see below*#define WINT_MIN *see below*#define WINT_MAX *see below*#define WINT_WIDTH *see below*#define INT*N*_C(value) *see below*#define UINT*N*_C(value) *see below*#define INTMAX_C(value) *see below*#define UINTMAX_C(value) *see below*
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L2044)
The header defines all types and macros the same as
the C standard library header [<stdint.h>](support.c.headers.general#header:%3cstdint.h%3e "17.15.1General[support.c.headers.general]")[.](#2.sentence-1)
The types denoted by intmax_t and uintmax_t are not required to be able to represent all values of extended integer types
wider than long long and unsigned long long, respectively[.](#2.sentence-2)
See also: ISO/IEC 9899:2024, 7.22
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L2053)
All types that use the placeholder *N* are optional when *N* is not 8, 16, 32, or 64[.](#3.sentence-1)
The exact-width typesint*N*_t and uint*N*_t for *N* = 8, 16, 32, and 64 are also optional;
however, if an implementation defines integer types
with the corresponding width and no padding bits,
it defines the corresponding [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4The typedef specifier[dcl.typedef]")*s*[.](#3.sentence-2)
Each of the macros listed in this subclause
is defined if and only if
the implementation defines the corresponding [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4The typedef specifier[dcl.typedef]")[.](#3.sentence-3)
[*Note [1](#note-1)*:
The macros INT*N*_C and UINT*N*_C correspond to the [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4The typedef specifier[dcl.typedef]")*s*int_least*N*_t and uint_least*N*_t,
respectively[.](#3.sentence-4)
— *end note*]