Fixed width integer types (since C99)
Inhaltsverzeichnis |
Typen
|
Definiert im Header
<stdint.h>
|
|
int8_t
int16_t
int32_t
int64_t
|
vorzeichenbehafteter Ganzzahltyp mit einer Breite von
exakt 8, 16, 32 bzw. 64 Bits ohne Füllbits und unter Verwendung von 2er-Komplement für negative Werte (nur bereitgestellt, wenn die Implementierung den Typ direkt unterstützt) |
int_fast8_t
int_fast16_t
int_fast32_t
int_fast64_t
|
schnellster vorzeichenbehafteter Ganzzahltyp mit einer Breite von
mindestens 8, 16, 32 bzw. 64 Bits |
int_least8_t
int_least16_t
int_least32_t
int_least64_t
|
kleinster vorzeichenbehafteter Ganzzahltyp mit einer Breite von
mindestens 8, 16, 32 bzw. 64 Bits |
intmax_t
|
Ganzzahltyp mit maximaler Breite |
intptr_t
|
Ganzzahltyp, der in der Lage ist, einen Zeiger zu halten |
uint8_t
uint16_t
uint32_t
uint64_t
|
vorzeichenloser Ganzzahltyp mit einer Breite von
exakt 8, 16, 32 bzw. 64 Bits (nur bereitgestellt, wenn die Implementierung den Typ direkt unterstützt) |
uint_fast8_t
uint_fast16_t
uint_fast32_t
uint_fast64_t
|
schnellster vorzeichenloser Ganzzahltyp mit einer Breite von
mindestens 8, 16, 32 bzw. 64 Bits |
uint_least8_t
uint_least16_t
uint_least32_t
uint_least64_t
|
kleinster vorzeichenloser Ganzzahltyp mit einer Breite von
mindestens 8, 16, 32 bzw. 64 Bits |
uintmax_t
|
vorzeichenloser Ganzzahltyp mit maximaler Breite |
uintptr_t
|
vorzeichenloser Ganzzahltyp, der in der Lage ist, einen Zeiger zu halten |
Die Implementierung kann Typedef-Namen definieren
int
N
_t
,
int_fast
N
_t
,
int_least
N
_t
,
uint
N
_t
,
uint_fast
N
_t
, und
uint_least
N
_t
, wenn
N
nicht 8, 16, 32 oder 64 ist. Typedef-Namen der Form
int
N
_t
dürfen nur definiert werden, wenn die Implementierung einen ganzzahligen Typ dieser Breite ohne Auffüllung unterstützt. Somit bezeichnet
uint24_t
einen vorzeichenlosen ganzzahligen Typ mit einer exakten Breite von 24 Bits.
Jedes der unten aufgeführten Makros ist genau dann definiert, wenn die Implementierung den entsprechenden Typnamen definiert. Die Makros
INT
N
_C
und
UINT
N
_C
entsprechen jeweils den Typnamen
int_least
N
_t
und
uint_least
N
_t
.
Makro-Konstanten
|
Definiert im Header
<stdint.h>
|
|
Vorzeichenbehaftete Ganzzahlen : Breite |
|
|
INT8_WIDTH
INT16_WIDTH
INT32_WIDTH
INT64_WIDTH
(C23)
(optional)
|
Bitbreite eines Objekts vom Typ
int8_t
,
int16_t
,
int32_t
,
int64_t
(exakt 8, 16, 32, 64)
(Makrokonstante) |
|
INT_FAST8_WIDTH
INT_FAST16_WIDTH
INT_FAST32_WIDTH
INT_FAST64_WIDTH
(C23)
|
Bitbreite eines Objekts vom Typ
int_fast8_t
,
int_fast16_t
,
int_fast32_t
,
int_fast64_t
(Makrokonstante) |
|
INT_LEAST8_WIDTH
INT_LEAST16_WIDTH
INT_LEAST32_WIDTH
INT_LEAST64_WIDTH
(C23)
|
Bitbreite eines Objekts vom Typ
int_least8_t
,
int_least16_t
,
int_least32_t
,
int_least64_t
(Makrokonstante) |
|
INTPTR_WIDTH
(C23)
(optional)
|
Bit-Breite eines Objekts vom Typ
intptr_t
(Makrokonstante) |
|
INTMAX_WIDTH
(C23)
|
Bitbreite eines Objekts vom Typ
intmax_t
(Makrokonstante) |
Vorzeichenbehaftete Ganzzahlen : Mindestwert |
|
|
INT8_MIN
INT16_MIN
INT32_MIN
INT64_MIN
|
Mindestwert eines Objekts vom Typ
int8_t
,
int16_t
,
int32_t
,
int64_t
(Makrokonstante) |
|
INT_FAST8_MIN
INT_FAST16_MIN
INT_FAST32_MIN
INT_FAST64_MIN
|
Mindestwert eines Objekts vom Typ
int_fast8_t
,
int_fast16_t
,
int_fast32_t
,
int_fast64_t
(Makrokonstante) |
|
INT_LEAST8_MIN
INT_LEAST16_MIN
INT_LEAST32_MIN
INT_LEAST64_MIN
|
Mindestwert eines Objekts vom Typ
int_least8_t
,
int_least16_t
,
int_least32_t
,
int_least64_t
(Makrokonstante) |
|
INTPTR_MIN
|
Mindestwert eines Objekts vom Typ
intptr_t
(Makrokonstante) |
|
INTMAX_MIN
|
Mindestwert eines Objekts vom Typ
intmax_t
(Makrokonstante) |
Vorzeichenbehaftete Ganzzahlen : Maximalwert |
|
|
INT8_MAX
INT16_MAX
INT32_MAX
INT64_MAX
|
Maximalwert eines Objekts vom Typ
int8_t
,
int16_t
,
int32_t
,
int64_t
(Makrokonstante) |
|
INT_FAST8_MAX
INT_FAST16_MAX
INT_FAST32_MAX
INT_FAST64_MAX
|
Maximalwert eines Objekts vom Typ
int_fast8_t
,
int_fast16_t
,
int_fast32_t
,
int_fast64_t
(Makrokonstante) |
|
INT_LEAST8_MAX
INT_LEAST16_MAX
INT_LEAST32_MAX
INT_LEAST64_MAX
|
Maximalwert eines Objekts vom Typ
int_least8_t
,
int_least16_t
,
int_least32_t
,
int_least64_t
(Makrokonstante) |
|
INTPTR_MAX
|
Maximalwert eines Objekts vom Typ
intptr_t
(Makrokonstante) |
|
INTMAX_MAX
|
Maximalwert eines Objekts vom Typ
intmax_t
(Makrokonstante) |
Vorzeichenlose Ganzzahlen : Breite |
|
|
UINT8_WIDTH
UINT16_WIDTH
UINT32_WIDTH
UINT64_WIDTH
(C23)
(optional)
|
Bitbreite eines Objekts vom Typ
uint8_t
,
uint16_t
,
uint32_t
,
uint64_t
(exakt 8, 16, 32, 64)
(Makrokonstante) |
|
UINT_FAST8_WIDTH
UINT_FAST16_WIDTH
UINT_FAST32_WIDTH
UINT_FAST64_WIDTH
(C23)
|
Bitbreite eines Objekts vom Typ
uint_fast8_t
,
uint_fast16_t
,
uint_fast32_t
,
uint_fast64_t
(Makrokonstante) |
|
UINT_LEAST8_WIDTH
UINT_LEAST16_WIDTH
UINT_LEAST32_WIDTH
UINT_LEAST64_WIDTH
(C23)
|
Bitbreite eines Objekts vom Typ
uint_least8_t
,
uint_least16_t
,
uint_least32_t
,
uint_least64_t
(Makrokonstante) |
|
UINTPTR_WIDTH
(C23)
(optional)
|
Bit-Breite eines Objekts vom Typ
uintptr_t
(Makrokonstante) |
|
UINTMAX_WIDTH
(C23)
|
Bitbreite eines Objekts vom Typ
uintmax_t
(Makrokonstante) |
Vorzeichenlose Ganzzahlen : Maximalwert |
|
|
UINT8_MAX
UINT16_MAX
UINT32_MAX
UINT64_MAX
|
Maximalwert eines Objekts vom Typ
uint8_t
,
uint16_t
,
uint32_t
,
uint64_t
(Makrokonstante) |
|
UINT_FAST8_MAX
UINT_FAST16_MAX
UINT_FAST32_MAX
UINT_FAST64_MAX
|
Maximalwert eines Objekts vom Typ
uint_fast8_t
,
uint_fast16_t
,
uint_fast32_t
,
uint_fast64_t
(Makrokonstante) |
|
UINT_LEAST8_MAX
UINT_LEAST16_MAX
UINT_LEAST32_MAX
UINT_LEAST64_MAX
|
Maximalwert eines Objekts vom Typ
uint_least8_t
,
uint_least16_t
,
uint_least32_t
,
uint_least64_t
(Makrokonstante) |
|
UINTPTR_MAX
|
Maximalwert eines Objekts vom Typ
uintptr_t
(Makrokonstante) |
|
UINTMAX_MAX
|
Maximalwert eines Objekts vom Typ
uintmax_t
(Makrokonstante) |
Funktionsmakros für Ganzzahlkonstanten mit Mindestbreite
|
INT8_C
INT16_C
INT32_C
INT64_C
|
Erweitert sich zu einem ganzzahligen konstanten Ausdruck mit dem durch sein Argument angegebenen Wert und dem Typ
int_least8_t
,
int_least16_t
,
int_least32_t
,
int_least64_t
entsprechend
(Funktionsmakro) |
|
INTMAX_C
|
Erweitert sich zu einem ganzzahligen konstanten Ausdruck mit dem durch sein Argument angegebenen Wert und dem Typ
intmax_t
(Funktionsmakro) |
|
UINT8_C
UINT16_C
UINT32_C
UINT64_C
|
Erweitert sich zu einem ganzzahligen konstanten Ausdruck mit dem durch sein Argument angegebenen Wert und dem Typ
uint_least8_t
,
uint_least16_t
,
uint_least32_t
,
uint_least64_t
entsprechend
(Funktionsmakro) |
|
UINTMAX_C
|
Erweitert sich zu einem ganzzahligen konstanten Ausdruck mit dem durch sein Argument angegebenen Wert und dem Typ
uintmax_t
(Funktionsmakro) |
#include <stdint.h> UINT64_C(0x123) // könnte zu 0x123ULL oder 0x123UL expandieren
Format-Makrokonstanten
|
Definiert im Header
<inttypes.h>
|
Formatkonstanten für die fprintf -Funktionsfamilie
Jedes der hier aufgeführten
PRI
Makros ist genau dann definiert, wenn die Implementierung den entsprechenden Typnamen definiert.
|
Äquivalent
für int oder unsigned int |
Beschreibung | Makros für Datentypen | ||||
|---|---|---|---|---|---|---|
[u]int
x
_t
|
[u]int_least
x
_t
|
[u]int_fast
x
_t
|
[u]intmax_t
|
[u]intptr_t
|
||
d
|
Ausgabe eines vorzeichenbehafteten dezimalen Ganzzahlwerts | PRId x | PRIdLEAST x | PRIdFAST x | PRIdMAX | PRIdPTR |
i
|
PRIi x | PRIiLEAST x | PRIiFAST x | PRIiMAX | PRIiPTR | |
u
|
Ausgabe eines vorzeichenlosen dezimalen Ganzzahlwerts | PRIu x | PRIuLEAST x | PRIuFAST x | PRIuMAX | PRIuPTR |
o
|
Ausgabe eines vorzeichenlosen oktalen Ganzzahlwerts | PRIo x | PRIoLEAST x | PRIoFAST x | PRIoMAX | PRIoPTR |
x
|
Ausgabe eines vorzeichenlosen hexadezimalen Ganzzahlwerts in Kleinbuchstaben | PRIx x | PRIxLEAST x | PRIxFAST x | PRIxMAX | PRIxPTR |
X
|
Ausgabe eines vorzeichenlosen hexadezimalen Ganzzahlwerts in Großbuchstaben | PRIX x | PRIXLEAST x | PRIXFAST x | PRIXMAX | PRIXPTR |
Formatkonstanten für die fscanf -Funktionsfamilie
Jedes der hier aufgeführten
SCN
Makros ist genau dann definiert, wenn die Implementierung den entsprechenden Typnamen definiert und einen geeigneten
fscanf
Längenmodifikator für den Typ besitzt.
|
Äquivalent
für int oder unsigned int |
Beschreibung | Makros für Datentypen | ||||
|---|---|---|---|---|---|---|
[u]int
x
_t
|
[u]int_least
x
_t
|
[u]int_fast
x
_t
|
[u]intmax_t
|
[u]intptr_t
|
||
d
|
Eingabe eines vorzeichenbehafteten dezimalen Ganzzahlwerts | SCNd x | SCNdLEAST x | SCNdFAST x | SCNdMAX | SCNdPTR |
i
|
Eingabe eines vorzeichenbehafteten Ganzzahlwerts (Basis wird durch die ersten geparsten Zeichen bestimmt) | SCNi x | SCNiLEAST x | SCNiFAST x | SCNiMAX | SCNiPTR |
u
|
Eingabe eines vorzeichenlosen dezimalen Ganzzahlwerts | SCNu x | SCNuLEAST x | SCNuFAST x | SCNuMAX | SCNuPTR |
o
|
Eingabe eines vorzeichenlosen oktalen Ganzzahlwerts | SCNo x | SCNoLEAST x | SCNoFAST x | SCNoMAX | SCNoPTR |
x
|
Eingabe eines vorzeichenlosen hexadezimalen Ganzzahlwerts | SCNx x | SCNxLEAST x | SCNxFAST x | SCNxMAX | SCNxPTR |
Beispiel
Siehe auch C++ Kompatibilitätshinweis bezüglich Leerzeichen vor Format-Makros die in diesem Beispiel verwendet werden.
Mögliche Ausgabe:
8 lld -9223372036854775808 +9223372036854775807 +7
Referenzen
- C23-Standard (ISO/IEC 9899:2024):
-
- 7.8.1 Makros für Formatbezeichner (S.: TBD)
-
- 7.18 Ganzzahltypen <stdint.h> (S.: TBD)
- C17-Standard (ISO/IEC 9899:2018):
-
- 7.8.1 Makros für Formatbezeichner (S: 158-159)
-
- 7.18 Ganzzahltypen <stdint.h> (S: 212-216)
- C11-Standard (ISO/IEC 9899:2011):
-
- 7.8.1 Makros für Format-Spezifizierer (S: 217-218)
-
- 7.18 Ganzzahltypen <stdint.h> (S: 289-295)
- C99-Standard (ISO/IEC 9899:1999):
-
- 7.8.1 Makros für Formatbezeichner (S: 198-199)
-
- 7.18 Ganzzahltypen <stdint.h> (S: 255-261)
Siehe auch
|
C++ Dokumentation
für
Fixed width integer types
|
|
|
C++ Dokumentation
für
User-defined literals (
formatting macros note
)
|