Node:Main Branch Integer Types, Next:, Previous:Natural Integer Types, Up:Integer Types



The Main Branch of Integer Types

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, Cardinal and Word (plus one Boolean type) are guaranteed to be compatible to the integer types of GNU C. The sizes given, however, are not guaranteed. They are just typical values currently used on most platforms, but they may be actually shorter or increase in the future.

signed unsigned also unsigned GNU C equivalent size in bits (typically)
ByteInt ByteCard Byte [un]signed char 8
ShortInt ShortCard ShortWord [unsigned] short int 16
Integer Cardinal Word [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.