inttypes.h(3avr)

πŸ“¦
version 2.2.1 Β· 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– inttypes.h πŸ’– (NAME)

okay bestie, gather round, because today we're talking about inttypes.h β€” the header that hands you the format specifier macros so your printf and scanf calls stop lying to you about integer widths. no cap. 🫢


✨ SYNOPSIS ✨

πŸŽ€ Macros

these are the macros for printf and scanf format specifiers. big important heads-up for the C++ girlies: for C++, these are only included if __STDC_LIMIT_MACROS is defined before including <inttypes.h>. so define it first or you're getting nothing. periodt. πŸ’…

#define PRId8   'd'
#define PRIdLEAST8   'd'
#define PRIdFAST8   'd'
#define PRIi8   'i'
#define PRIiLEAST8   'i'
#define PRIiFAST8   'i'
#define PRId16   'd'
#define PRIdLEAST16   'd'
#define PRIdFAST16   'd'
#define PRIi16   'i'
#define PRIiLEAST16   'i'
#define PRIiFAST16   'i'
#define PRId32   'ld'
#define PRIdLEAST32   'ld'
#define PRIdFAST32   'ld'
#define PRIi32   'li'
#define PRIiLEAST32   'li'
#define PRIiFAST32   'li'
#define PRIdPTR   PRId16
#define PRIiPTR   PRIi16
#define PRIo8   'o'
#define PRIoLEAST8   'o'
#define PRIoFAST8   'o'
#define PRIu8   'u'
#define PRIuLEAST8   'u'
#define PRIuFAST8   'u'
#define PRIx8   'x'
#define PRIxLEAST8   'x'
#define PRIxFAST8   'x'
#define PRIX8   'X'
#define PRIXLEAST8   'X'
#define PRIXFAST8   'X'
#define PRIo16   'o'
#define PRIoLEAST16   'o'
#define PRIoFAST16   'o'
#define PRIu16   'u'
#define PRIuLEAST16   'u'
#define PRIuFAST16   'u'
#define PRIx16   'x'
#define PRIxLEAST16   'x'
#define PRIxFAST16   'x'
#define PRIX16   'X'
#define PRIXLEAST16   'X'
#define PRIXFAST16   'X'
#define PRIo32   'lo'
#define PRIoLEAST32   'lo'
#define PRIoFAST32   'lo'
#define PRIu32   'lu'
#define PRIuLEAST32   'lu'
#define PRIuFAST32   'lu'
#define PRIx32   'lx'
#define PRIxLEAST32   'lx'
#define PRIxFAST32   'lx'
#define PRIX32   'lX'
#define PRIXLEAST32   'lX'
#define PRIXFAST32   'lX'
#define PRIoPTR   PRIo16
#define PRIuPTR   PRIu16
#define PRIxPTR   PRIx16
#define PRIXPTR   PRIX16
#define SCNd8   'hhd'
#define SCNdLEAST8   'hhd'
#define SCNdFAST8   'hhd'
#define SCNi8   'hhi'
#define SCNiLEAST8   'hhi'
#define SCNiFAST8   'hhi'
#define SCNd16   'd'
#define SCNdLEAST16   'd'
#define SCNdFAST16   'd'
#define SCNi16   'i'
#define SCNiLEAST16   'i'
#define SCNiFAST16   'i'
#define SCNd32   'ld'
#define SCNdLEAST32   'ld'
#define SCNdFAST32   'ld'
#define SCNi32   'li'
#define SCNiLEAST32   'li'
#define SCNiFAST32   'li'
#define SCNdPTR   SCNd16
#define SCNiPTR   SCNi16
#define SCNo8   'hho'
#define SCNoLEAST8   'hho'
#define SCNoFAST8   'hho'
#define SCNu8   'hhu'
#define SCNuLEAST8   'hhu'
#define SCNuFAST8   'hhu'
#define SCNx8   'hhx'
#define SCNxLEAST8   'hhx'
#define SCNxFAST8   'hhx'
#define SCNo16   'o'
#define SCNoLEAST16   'o'
#define SCNoFAST16   'o'
#define SCNu16   'u'
#define SCNuLEAST16   'u'
#define SCNuFAST16   'u'
#define SCNx16   'x'
#define SCNxLEAST16   'x'
#define SCNxFAST16   'x'
#define SCNo32   'lo'
#define SCNoLEAST32   'lo'
#define SCNoFAST32   'lo'
#define SCNu32   'lu'
#define SCNuLEAST32   'lu'
#define SCNuFAST32   'lu'
#define SCNx32   'lx'
#define SCNxLEAST32   'lx'
#define SCNxFAST32   'lx'
#define SCNoPTR   SCNo16
#define SCNuPTR   SCNu16
#define SCNxPTR   SCNx16

like, look at the way the PRI* girlies handle output and the SCN* girlies handle input, and then the width suffix (8, 16, 32, LEAST*, FAST*) tells you which flavour of integer you're dealing with. the PTR ones just borrow from their 16 besties (PRIdPTR is PRId16, PRIiPTR is PRIi16, PRIoPTR is PRIo16, PRIuPTR is PRIu16, PRIxPTR is PRIx16, PRIXPTR is PRIX16, and same deal on the scan side: SCNdPTR is SCNd16, SCNiPTR is SCNi16, SCNoPTR is SCNo16, SCNuPTR is SCNu16, SCNxPTR is SCNx16). iconic behaviour honestly. πŸ¦‹


πŸ¦‹ Typedefs

far pointers for memory access > 64K, because sometimes you gotta reach all the way across the address space. πŸ’«

typedef int32_t int_farptr_t
typedef uint32_t uint_farptr_t

πŸ‘‘ Author

Generated automatically by Doxygen for AVR-LibC from the source code. (not a human author, just the machine doing its thing ✨)


okay that's the whole page, bestie, you're officially fluent πŸ’œ this lil manual page came to you courtesy of AVR-LibC, Version 2.2.1 β€” mwah, go forth and format your integers correctly, i'm obsessed with you πŸŽ€πŸ’…πŸŒΈ

πŸ“¦ where this page comes from