Word

A word is the processor’s native data unit. Modern consumer processors have a word width of 64 bits.

Data type

edit

Most run-time libraries provide the native data type of a processor as the Pascal data type word. It is a subset of all whole numbers (non-negative integers) that can be represented by the processor’s natural data unit size.

On a 64-bit architecture this means a word is an integer within the range [0,~2^{64}-1]. On a 32-bit architecture a word will be an integer in the range [0,~2^{32}-1], and so on, respectively.

In GNU Pascal a word is just an alias for cardinal, which has the same properties regarding possible values.

If a signed integer having the processor’s native size is wanted, the data type integer provides this functionality.

FPC

edit

For source compatibility reasons, FPC defines word in the same way as Turbo Pascal and Delphi: the subrange data type 0..65535. The high value 65535 is 2^{16}-1. Thus a system.word occupies two bytes of space. Subrange data types are stored in a quantity that serves best the goals of performance and memory efficiency.

The processor’s native word size, as defined above, corresponds to different types depending on the purpose you want to use it for:

On many platforms, all of these types have the same size, but it is not the case everywhere.

In FPC a smallInt has the same size as a word, but is signed.

navigation bar: data types

simple data types boolean byte cardinal char currency double dword extended int8 int16 int32 int64 integer longint real shortint single smallint pointer qword word
complex data types array class object record set string shortstring