Node:Summary of Integer Types, Previous:Integer Types and Compatibility, Up:Integer Types

##### Summary of Integer Types

Here is a summary of all integer types defined in GPC. The sizes and ranges are only typical values, valid on some, but not all platforms. Compatibility to GNU C however is guaranteed.

ByteInt
  signed 8-bit integer type, `-128..128`,
  compatible to `signed char` in GNU C.
Byte
  unsigned 8-bit integer type, `0..255`,
  compatible to `unsigned char` in GNU C.
ShortInt
  signed 16-bit integer type, `-32768..32767`,
  compatible to `short int` in GNU C.
ShortWord
  unsigned 16-bit integer type, `0..65535`,
  compatible to `unsigned short int` in GNU C.
Integer
  signed 32-bit integer type, `-2147483648..2147483647`,
  compatible to `int` in GNU C.
Word
  unsigned 32-bit integer type, `0..4294967295`,
  compatible to `unsigned int` in GNU C.
MedInt
  signed 32-bit integer type, `-2147483648..2147483647`,
  compatible to `long int` in GNU C.
MedWord
  unsigned 32-bit integer type, `0..4294967295`,
  compatible to `unsigned long int` in GNU C.
LongInt
  signed 64-bit integer type, `-9223372036854775808..9223372036854775807`,
  compatible to `long long int` in GNU C.
LongWord
  unsigned 64-bit integer type, `0..18446744073709551615`,
  compatible to `unsigned long long int` in GNU C.
LongestInt
  signed 64-bit integer type, `-9223372036854775808..9223372036854775807`.
LongestWord
  unsigned 64-bit integer type, `0..18446744073709551615`.
Comp
  signed 64-bit integer type, `-9223372036854775808..9223372036854775807`.
SmallInt
  signed 16-bit integer type, `-32768..32767`.
SizeType
  integer type (usually unsigned) to represent the size of objects in memory
PtrDiffType
  signed integer type to represent the difference between two positions in memory
PtrInt
  signed integer type of the same size as a pointer
PtrWord
  unsigned integer type of the same size as a pointer

To specify the number of bits definitely, use type attributes, attribute.

    program IntegerTypesDemo (Output);

    var
      ByteVar: Byte;
      ShortIntVar: ShortInt;
      Foo: MedCard;
      Big: LongestInt;

    begin
      ShortIntVar := 1000;
      Big := MaxInt * ShortIntVar;
      ByteVar := 127;
      Foo := 16#deadbeef
    end.

See also: Subrange Types.