Integer is a standard type of the Pascal Programming language. It is used to define a whole number, as opposed to a real data type (which is used to define a floating point number which may contain a decimal point and possibly an exponent).
The size of an integer is dependent upon the bit size of the target machine to which the compiler is to generate code (32 bit or 64 bit), the type of compiler (16-bit, 32-bit or 64-bit), and upon compiler switches in some cases. Typical sizes of integer generally are
- 16 bit (2 byte)
- 32 bit (4 byte) or
- 64 bit (8 byte)
For 64-bit calculation, FPC does support 64-bit Int64 though, which may be defined as a value of -263 through 263-1, or -9 223 372 036 854 775 808 ... 9 223 372 036 854 775 807.
This will cause code expecting an integer and a pointer to be the same size to fail as a 64bit machine uses 64-bit pointers. To allow you to write portable code, the FPC system unit introduces the types PtrInt and PtrUInt which are signed and unsigned integer data types with the same size as a pointer.
On older compilers, an integer was 16 bits, and represented values from -215 through 215-1, or -32 768 through 32 767. A similar data type, word, was sometimes used to define an unsigned integer (0..65 535). In such cases where the compiler used a 16-bit integer type, 32-bit integers would usually be expressed by the long or longint data type.
For x86 machines, an integer is generally defined as 32 bits, and encompasses the values of -231 through 231-1, or -2 147 483 648 .. 2 147 483 647. The latter value is also defined as the constant maxint. The unsigned 32 bit integer type cardinal has a range of 0 through 232-1 or 0 .. 4 294 967 295.
|simple data types|
|complex data types|