Difference between revisions of "LongWord"
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Longword}} | {{Longword}} | ||
− | + | A '''{{Doc|package=RTL|unit=system|identifier=longword|text=<syntaxhighlight lang="delphi" inline>longWord</syntaxhighlight>}}''' is an unsigned integer data type which is ''larger'' than a [[Word|<syntaxhighlight lang="delphi" inline>word</syntaxhighlight>]].<sup>[https://www.gnu-pascal.de/gpc/LongWord.html]</sup> | |
+ | Larger refers to both the permissible range of values and the [[SizeOf|size]] occupied in a [[Packed|<syntaxhighlight lang="pascal" inline>packed</syntaxhighlight>]] structure. | ||
+ | == Definition == | ||
+ | === GNU Pascal Compiler === | ||
+ | In [[GNU Pascal]] a <syntaxhighlight lang="delphi" inline>longWord</syntaxhighlight> is compatible to GNU [[Pascal for C users|C]]’s {{Doc|package=RTL|unit=ctypes|identifier=culonglong|text=<syntaxhighlight lang="c" inline style="whitespace: nowrap;">long long unsigned int</syntaxhighlight>}}. | ||
+ | On ''some'' platforms it is 64 bits wide and thus has a range of <syntaxhighlight lang="pascal" inline>0..18446744073709551615</syntaxhighlight> (<math>\mathbb{Z} \cap \left[0, 2^{64}\right)</math>). | ||
− | [[ | + | === Free Pascal Compiler === |
+ | For compatibility with [[Delphi]], the [[FPC]] ''always'' defines <syntaxhighlight lang="delphi" inline>longWord</syntaxhighlight> as a 32-bit quantity, thus it may assume a value in the range <syntaxhighlight lang="pascal" inline>0..4294967295</syntaxhighlight> (<math>\mathbb{Z} \cap \left[0, 2^{32}\right)</math>). | ||
+ | The defunct [[Mode GPC|<syntaxhighlight lang="delphi" inline style="whitespace: nowrap;">{$mode GPC}</syntaxhighlight>]] [[Compiler Mode|compiler compatibility mode]] did not change this. | ||
+ | In this definition, {{Doc|package=RTL|unit=system|identifier=dword|text=<syntaxhighlight lang="delphi" inline>dWord</syntaxhighlight>}} (double word) is an alias for <syntaxhighlight lang="delphi" inline>longWord</syntaxhighlight>. | ||
+ | As of version 3.2.0 the data type [[Cardinal|<syntaxhighlight lang="delphi" inline>cardinal</syntaxhighlight>]] is an ''unconditional'' alias for <syntaxhighlight lang="delphi" inline>longWord</syntaxhighlight>. | ||
+ | |||
+ | == Application == | ||
+ | * Because the FPC’s definition is fixed in size, it is frequently used when defining the ''exact'' memory layout of [[Record|<syntaxhighlight lang="pascal" inline>record</syntaxhighlight>]] data types that will be passed to foreign language libraries. If the external library is written C, use of the {{Doc|package=RTL|unit=ctypes|text=<syntaxhighlight lang="delphi" inline>cTypes unit</syntaxhighlight>}} is recommended. | ||
+ | * Likewise, the GPC guarantees compatibility of certain integer data types with GNU C.<sup>[https://www.gnu-pascal.de/gpc/Summary-of-Integer-Types.html]</sup> For maximum range, the GPC also defines <syntaxhighlight lang="pascal" inline>longestWord</syntaxhighlight>. | ||
+ | |||
+ | == See Also == | ||
+ | * [[Longint|<syntaxhighlight lang="delphi" inline>longInt</syntaxhighlight>]] | ||
+ | * {{Doc|package=RTL|unit=system|identifier=plongword|text=<syntaxhighlight lang="delphi" inline>pLongWord</syntaxhighlight>}} | ||
+ | * {{Doc|package=RTL|unit=types|identifier=tlongworddynarray|text=<syntaxhighlight lang="delphi" inline>types.tLongWordDynArray</syntaxhighlight>}} | ||
+ | |||
+ | {{Data types}} |
Latest revision as of 13:25, 22 December 2023
│
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 thecTypes 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
simple data types |
|
---|---|
complex data types |