stdint.h(3)

πŸ“¦ version 2.2.1, in fedora 43, fedora 44, opensuse-leap 16.0

✨ NAME ✨

stdint.h β€” the header that gives you integer types with actual guaranteed widths, bestie πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

Macros

🌸 Limits of specified-width integer types

okay so real talk: if you're writing C++ you should only define these macros when __STDC_LIMIT_MACROS is defined before <stdint.h> gets included. iykyk πŸ‘‘

#define INT8_MAX   0x7f
#define INT8_MIN   (-INT8_MAX - 1)
#define UINT8_MAX   (INT8_MAX * 2 + 1)
#define INT16_MAX   0x7fff
#define INT16_MIN   (-INT16_MAX - 1)
#define UINT16_MAX   (__CONCAT(INT16_MAX, U) * 2U + 1U)
#define INT32_MAX   0x7fffffffL
#define INT32_MIN   (-INT32_MAX - 1L)
#define UINT32_MAX   (__CONCAT(INT32_MAX, U) * 2UL + 1UL)
#define INT64_MAX   0x7fffffffffffffffLL
#define INT64_MIN   (-INT64_MAX - 1LL)
#define UINT64_MAX   (__CONCAT(INT64_MAX, U) * 2ULL + 1ULL)

πŸ¦‹ Limits of minimum-width integer types

#define INT_LEAST8_MAX   INT8_MAX
#define INT_LEAST8_MIN   INT8_MIN
#define UINT_LEAST8_MAX   UINT8_MAX
#define INT_LEAST16_MAX   INT16_MAX
#define INT_LEAST16_MIN   INT16_MIN
#define UINT_LEAST16_MAX   UINT16_MAX
#define INT_LEAST32_MAX   INT32_MAX
#define INT_LEAST32_MIN   INT32_MIN
#define UINT_LEAST32_MAX   UINT32_MAX
#define INT_LEAST64_MAX   INT64_MAX
#define INT_LEAST64_MIN   INT64_MIN
#define UINT_LEAST64_MAX   UINT64_MAX

πŸ’… Limits of fastest minimum-width integer types

#define INT_FAST8_MAX   INT8_MAX
#define INT_FAST8_MIN   INT8_MIN
#define UINT_FAST8_MAX   UINT8_MAX
#define INT_FAST16_MAX   INT16_MAX
#define INT_FAST16_MIN   INT16_MIN
#define UINT_FAST16_MAX   UINT16_MAX
#define INT_FAST32_MAX   INT32_MAX
#define INT_FAST32_MIN   INT32_MIN
#define UINT_FAST32_MAX   UINT32_MAX
#define INT_FAST64_MAX   INT64_MAX
#define INT_FAST64_MIN   INT64_MIN
#define UINT_FAST64_MAX   UINT64_MAX

🫢 Limits of integer types capable of holding object pointers

#define INTPTR_MAX   INT16_MAX
#define INTPTR_MIN   INT16_MIN
#define UINTPTR_MAX   UINT16_MAX

⭐ Limits of greatest-width integer types

#define INTMAX_MAX   INT64_MAX
#define INTMAX_MIN   INT64_MIN
#define UINTMAX_MAX   UINT64_MAX

🌈 Limits of other integer types

again, C++ girlies: only define these when __STDC_LIMIT_MACROS is defined before <stdint.h> is included. not optional, fr fr

#define PTRDIFF_MAX   INT16_MAX
#define PTRDIFF_MIN   INT16_MIN
#define SIG_ATOMIC_MAX   INT8_MAX
#define SIG_ATOMIC_MIN   INT8_MIN
#define SIZE_MAX   UINT16_MAX
#define WCHAR_MAX   __WCHAR_MAX__
#define WCHAR_MIN   __WCHAR_MIN__
#define WINT_MAX   __WINT_MAX__
#define WINT_MIN   __WINT_MIN__

🧚 Macros for integer constants

C++ besties, same deal: only define these macros when __STDC_CONSTANT_MACROS is defined before <stdint.h> is included.

these definitions are valid for integer constants without suffix, and for macros defined as integer constant without suffix πŸ’œ

#define INT8_C(value)   ((int8_t) value)
#define UINT8_C(value)   ((uint8_t) __CONCAT(value, U))
#define INT16_C(value)   value
#define UINT16_C(value)   __CONCAT(value, U)
#define INT32_C(value)   __CONCAT(value, L)
#define UINT32_C(value)   __CONCAT(value, UL)
#define INT64_C(value)   __CONCAT(value, LL)
#define UINT64_C(value)   __CONCAT(value, ULL)
#define INTMAX_C(value)   __CONCAT(value, LL)
#define UINTMAX_C(value)   __CONCAT(value, ULL)

Typedefs

πŸ’– Exact-width integer types

integer types that are exactly the width it says on the tin. no surprises, no drama, iconic behavior πŸ‘‘

typedef signed char int8_t
typedef unsigned char uint8_t
typedef signed int int16_t
typedef unsigned int uint16_t
typedef signed long int int32_t
typedef unsigned long int uint32_t
typedef signed long long int int64_t
typedef unsigned long long int uint64_t

πŸ”₯ Integer types capable of holding object pointers

these ones let you declare variables the same size as a pointer. matching energy, always 🫢

typedef int16_t intptr_t
typedef uint16_t uintptr_t

🌸 Minimum-width integer types

integer types that have at least the width specified. floor's the floor, she can go higher πŸ’…

typedef int8_t int_least8_t
typedef uint8_t uint_least8_t
typedef int16_t int_least16_t
typedef uint16_t uint_least16_t
typedef int32_t int_least32_t
typedef uint32_t uint_least32_t
typedef int64_t int_least64_t
typedef uint64_t uint_least64_t

✨ Fastest minimum-width integer types

integer types that are usually the fastest while still having at least the width specified. speed AND range, main character combo πŸ’–

typedef int8_t int_fast8_t
typedef uint8_t uint_fast8_t
typedef int16_t int_fast16_t
typedef uint16_t uint_fast16_t
typedef int32_t int_fast32_t
typedef uint32_t uint_fast32_t
typedef int64_t int_fast64_t
typedef uint64_t uint_fast64_t

🌈 Greatest-width integer types

types that designate integer data capable of representing any value of any integer type in the corresponding signed or unsigned category. they hold everything, they're the moment, periodt ⭐

typedef int64_t intmax_t
typedef uint64_t uintmax_t

πŸŽ€ Author πŸŽ€

Generated automatically by Doxygen for avr-libc from the source code. (not me writing it by hand, the robots did that part πŸ™ˆ)


ok that's the whole page bestie, go forth and #include <stdint.h> responsibly πŸ’…

avr-libc version 2.1.0 β€” dated Sat Jan 29 2022 β€” mwah, love u, bye 🩷

πŸ“¦ where this page comes from