Difference between revisions of "PtrInt"
From Lazarus wiki
Jump to navigationJump to search (categorize page, insert links in dead-end page, rework) |
(add pronunciation of ptrUInt) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | The data types '''{{Doc|package=RTL|unit=system|identifier=ptrint|text=<syntaxhighlight lang="delphi" inline>ptrInt</syntaxhighlight>}}''' (“Peter Int”) and '''{{Doc|package=RTL|unit=system|identifier=ptruint|text=<syntaxhighlight lang="delphi" inline>ptrUInt</syntaxhighlight>}}''' are signed and unsigned [[Integer|<syntaxhighlight lang="pascal" inline>integer</syntaxhighlight>]] [[Data type|data types]] respectively having the same [[SizeOf|<syntaxhighlight lang="delphi" inline>sizeOf</syntaxhighlight>]] of a [[Pointer|<syntaxhighlight lang="delphi" inline>pointer</syntaxhighlight>]]. | + | The data types '''{{Doc|package=RTL|unit=system|identifier=ptrint|text=<syntaxhighlight lang="delphi" inline>ptrInt</syntaxhighlight>}}''' (“Peter Int”) and '''{{Doc|package=RTL|unit=system|identifier=ptruint|text=<syntaxhighlight lang="delphi" inline>ptrUInt</syntaxhighlight>}}''' (“Pee true Int”) are signed and unsigned [[Integer|<syntaxhighlight lang="pascal" inline>integer</syntaxhighlight>]] [[Data type|data types]] respectively having the same [[SizeOf|<syntaxhighlight lang="delphi" inline>sizeOf</syntaxhighlight>]] of a [[Pointer|<syntaxhighlight lang="delphi" inline>pointer</syntaxhighlight>]]. |
== application == | == application == | ||
− | * Use <syntaxhighlight lang="delphi" inline> | + | * Use <syntaxhighlight lang="delphi" inline>ptrUInt</syntaxhighlight> if an <syntaxhighlight lang="pascal" inline>integer</syntaxhighlight> value will eventually be [[Typecast|typecasted]] to a <syntaxhighlight lang="delphi" inline>pointer</syntaxhighlight>. |
* Regardless of the size taken up by its elements, an [[Array|<syntaxhighlight lang="pascal" inline>array</syntaxhighlight>]] cannot have more than <syntaxhighlight lang="delphi" inline>high(ptrInt)</syntaxhighlight> elements. Additionally, the range type must be a subrange of <syntaxhighlight lang="delphi" inline>ptrInt</syntaxhighlight>.<sup>[https://www.freepascal.org/docs-html/current/user/userse62.html]</sup> | * Regardless of the size taken up by its elements, an [[Array|<syntaxhighlight lang="pascal" inline>array</syntaxhighlight>]] cannot have more than <syntaxhighlight lang="delphi" inline>high(ptrInt)</syntaxhighlight> elements. Additionally, the range type must be a subrange of <syntaxhighlight lang="delphi" inline>ptrInt</syntaxhighlight>.<sup>[https://www.freepascal.org/docs-html/current/user/userse62.html]</sup> | ||
Latest revision as of 18:26, 25 January 2022
The data types ptrInt
(“Peter Int”) and ptrUInt
(“Pee true Int”) are signed and unsigned integer
data types respectively having the same sizeOf
of a pointer
.
application
- Use
ptrUInt
if aninteger
value will eventually be typecasted to apointer
. - Regardless of the size taken up by its elements, an
array
cannot have more thanhigh(ptrInt)
elements. Additionally, the range type must be a subrange ofptrInt
.[1]
notes
PtrInt
/ptrUInt
are not necessarily the same size ofALUSInt
/ALUUInt
.- The introduction of
ptrInt
was a mistake. New code should not use it. IntPtr
andnativeInt
are aliases forptrInt
.UIntPtr
andnativeUInt
are aliases forptrUInt
.PtrInt
andptrUInt
are redefined by theunit
unicodeData
.