STDINT(3)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸ’– stdint(3) β€” standard integer types πŸ’–

okay so bestie, welcome to stdint.h, the header that's literally the main character of "i need an integer of exactly this many bits" energy. it's stdint from section 3 of the library functions manual, and we're gonna get into it.

✨ SYNOPSIS ✨

#include <stdint.h>

that's it. that's the whole vibe check. one include and you're in. 🫢


🌸 DESCRIPTION 🌸

the <stdint.h> header is giving source-portable integer types of a specific size, plus friends: smallest memory footprint with a minimum size, fastest access speed with a minimum size, largest integer size, and the ones capable of storing pointers. it's a whole little family, ngl. πŸ‘‘

πŸŽ€ the exact-width girlies

the types int8_t, int16_t, int32_t, and int64_t provide a signed integer type of width 8, 16, 32, or 64 bits, respectively. and the types uint8_t, uint16_t, uint32_t, and uint64_t provide an unsigned integer type of width 8, 16, 32, or 64 bits, respectively.

these integer types should be used when a specific size is required. like, you need exactly 32 bits? this is your girl. no cap. πŸ’…

πŸ’… the fast girlies

the types int_fast8_t, int_fast16_t, int_fast32_t, and int_fast64_t provide the fastest signed integer type with a width of at least 8, 16, 32, or 64 bits, respectively. and the types uint_fast8_t, uint_fast16_t, uint_fast32_t, and uint_fast64_t provide the fastest unsigned integer type with a width of at least 8, 16, 32, or 64 bits, respectively.

these types should be used when access speed is paramount, and when a specific size is not required. speed over exactness, periodt. πŸ”₯

πŸ¦‹ the small-footprint girlies

the types int_least8_t, int_least16_t, int_least32_t, and int_least64_t provide the smallest memory footprint signed integer type with a width of at least 8, 16, 32, or 64 bits, respectively. and the types uint_least8_t, uint_least16_t, uint_least32_t, and uint_least64_t provide the smallest memory footprint unsigned integer type with a width of at least 8, 16, 32, or 64 bits, respectively.

these types should be used when memory storage is of concern, and when a specific size is not required. tiny but mighty, we stan. 🌸

πŸ‘‘ the maxxing girlies

the type intmax_t provides a signed integer type large enough to hold any other signed integer. the type uintmax_t provides an unsigned integer type large enough to hold any other unsigned integer.

these types are generally the largest signed and unsigned integer types available on a specific architecture. absolute units. iconic. πŸ’€

🧚 the pointer girlies

the type intptr_t provides a signed integer type with the ability to hold a pointer to void, that can later be converted back to a pointer to void.

the type uintptr_t provides an unsigned integer type with the ability to hold a pointer to void, that can later be converted back to a pointer to void.

pointer goes in, pointer comes back out, the way that round-trips. 🌈✨


πŸŽ€ SEE ALSO πŸŽ€

go read those too, iykyk πŸ¦‹

⭐ STANDARDS ⭐

the <stdint.h> header conforms to ISO/IEC 9899:1999 (β€œISO C99”) and IEEE Std 1003.1-2001 (β€œPOSIX.1”). certified official, fr fr. βœ…

πŸ’œ HISTORY πŸ’œ

the <stdint.h> header was first introduced in NetBSD 1.6. a legend from the start, honestly. πŸ™ˆ


and that's the tea, bestie πŸ’– this lil page is a Debian joint, dated August 9, 2011, and it lives in section 3 β€” STDINT(3) β€” so go forth and pick your integer type with intention. slay. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from