[fpc-pascal] Platform Dependent Integer Types
Marco van de Voort
marcov at stack.nl
Fri Apr 7 16:15:11 CEST 2017
In our previous episode, African Wild Dog said:
> Which integer types have their size dependent on platform?
> E.g. in Delphi, LongInt can 32 or 64 bits depending on the platform.
In Delphi they retroactively equated longint to C long, being 32-bit on
64-bits windows and 64-bit on Linux. The Delphi Linux compiler is btw a
different compiler than windows.
On FPC it is always 32-bit. Ptrint and ptruint scale with pointer size, and
integer depends on compilation mode, 16 or 32-bit.
For the C compiler that FPC corresponds with (usually gcc), there are types
that correspond with C types in unit ctypes.
Maybe some of the new ultra small targets like AVR make exceptions, but
those are the general rules.
> On AVR this is 8-bit. ", but it is not clear about which integer types are
The typical pascal solution is to use subranges and hope the compiler will
More information about the fpc-pascal