LongWord

From Free Pascal wiki
(Redirected from Longword)
Jump to navigationJump to search

English (en)

A longWord is an unsigned integer data type which is larger than a word.[1] Larger refers to both the permissible range of values and the size occupied in a packed structure.

Definition

GNU Pascal Compiler

In GNU Pascal a longWord is compatible to GNU C’s long long unsigned int. On some platforms it is 64 bits wide and thus has a range of 0..18446744073709551615 ([math]\displaystyle{ \mathbb{Z} \cap \left[0, 2^{64}\right) }[/math]).

Free Pascal Compiler

For compatibility with Delphi, the FPC always defines longWord as a 32-bit quantity, thus it may assume a value in the range 0..4294967295 ([math]\displaystyle{ \mathbb{Z} \cap \left[0, 2^{32}\right) }[/math]). The defunct {$mode GPC} compiler compatibility mode did not change this. In this definition, dWord (double word) is an alias for longWord. As of version 3.2.0 the data type cardinal is an unconditional alias for longWord.

Application

  • Because the FPC’s definition is fixed in size, it is frequently used when defining the exact memory layout of record data types that will be passed to foreign language libraries. If the external library is written C, use of the cTypes unit is recommended.
  • Likewise, the GPC guarantees compatibility of certain integer data types with GNU C.[2] For maximum range, the GPC also defines longestWord.

See Also


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