Integer, Cardinal, and Word define the three “main branches” of GPC's integer types. You won't always be able to deal with the natural size; sometimes something smaller or longer will be needed. Especially when interfacing with libraries written in other languages such as C, you will need equivalents for their integer types.
The following variants of integer types (plus one Boolean type) are guaranteed to be compatible to the respective types of GNU C as listed below (whereas Integer, Cardinal and Word themselves are not guaranteed to be compatible to any given C type). The sizes given, however, are not guaranteed. They are just typical values currently used on some platforms, but they may be actually shorter or longer on any given platform.
signed | unsigned | also unsigned | GNU C equivalent | size in bits (example)
|
ByteInt | ByteCard | Byte | [un]signed char | 8
|
ShortInt | ShortCard | ShortWord | [unsigned] short int | 16
|
CInteger | CCardinal | CWord | [unsigned] int | 32
|
MedInt | MedCard | MedWord | [unsigned] long int | 32
|
LongInt | LongCard | LongWord | [unsigned] long long int | 64
|
— | SizeType | — | size_t | 32
|
PtrDiffType | — | — | ptrdiff_t | 32
|
PtrInt | PtrCard | PtrWord | — | 32
|
— | CBoolean | — | _Bool, bool | 8
|
Since we don't know whether LongInt will always remain the “longest” integer type available – maybe GNU C will get long long long int, one day, which we will support as LongLongInt – we have added the synonym LongestInt for the longest available singed integer type, and the same holds for LongestCard and LongestWord.