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. Newer versions of Delphi handle these types as strong aliases. In order to be compatible with the change, C++ will also create strong aliases using a class wrapper.

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