System.NativeInt

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

type NativeInt = { built-in type };

C++

typedef int                  NativeInt;          //

Properties

Type Visibility Source Unit Parent
type
typedef
public
System.pas
sysmac.h
System System

Description

Defines a platform-dependent signed integer.

NativeInt represents a subset of the integer numbers. The range of NativeInt depends on the current platform. On 32-bit platforms, NativeInt is equivalent to the Integer type. On 64-bit platforms, NativeInt is equivalent to the Int64 type.

The size of NativeInt is equivalent to the size of the pointer on the current platform.

Earlier versions of Delphi mapped built-in types such as NativeInt, NativeUInt, ByteBool, WordBool, LongBool to C++ built-in types.

As of RAD Studio 12.0, in the Delphi compiler, NativeInt becomes a weak alias, meaning that it cannot be used as a separate type anymore. It can be used instead of the two counterparts, but you cannot overload methods using both NativeInt and one of the matching native types, since this will give an error.

Note: To avoid ambiguity, conversions must be explicit, as the following code example illustrates.
  NativeInt ni = 100; //Wrong. Will issue an Error
  NativeInt ni = NativeInt(100); //Correct
  System::GetMemory(0x100); // Error
  System::GetMemory(NativeInt(0x100)); //Correct

See Also