Unit 'System' Package
[Overview][Constants][Types][Index] [#rtl]

PtrInt

Signed integer type with same size as Pointer.

Declaration

Source position: systemh.inc line 460

type PtrInt = LongInt;

Description

Ptrint is a signed integer type which has always the same size as a pointer. Ptrint is considered harmful and should almost never be used in actual code, because pointers are normally unsigned. For example, consider the following code:

getmem(p,2048);                 {Assume the address of p becomes $7ffffff0.}
q:=pointer(ptrint(p)+1024));    {Overflow error.}
writeln(q>p);                   {Incorrect answer.}

Ptrint might have a valid use when two pointers are subtracted from each other if it is unknown which pointer has the largest address. However, even in this case ptrint causes trouble in case the distance is larger than high(ptrint) and must be used with great care.

The introduction of the ptrint type was a mistake. Please use PtrUInt instead.

See also

PtrUInt

  

Unsigned integer type with same size as Pointer.

SizeInt

  

Signed integer type which fits for sizes.

SizeUInt

  

Unsigned Integer type which fits for sizes.


Documentation generated on: Dec 24 2024