64-bit Data Types Compared to 32-bit Data Types

From RAD Studio XE2
Jump to: navigation, search

Go Up to 64-bit Cross-Platform Application Development for Windows


The following tables summarize the differences and similarities between 64-bit OS data types and 32-bit OS data types.

Delphi 32-bit and 64-bit Built-in Type Sizes

Integral types

On Win64, NativeInt is twice the size of the Win32 NativeInt, and NativeUInt is twice the size of the Win32 NativeUInt.

Signed Integer

Unsigned Integer

Delphi/32

Delphi/64

Comments

ShortInt

Byte

1 byte

SmallInt

Word

2 bytes

LongInt

LongWord

4 bytes

Integer

Cardinal

4 bytes

Int64

UInt64

8 bytes

NativeInt

NativeUInt

4 bytes

8 bytes

Pointer types

On 64-bit Windows, all pointer types are 8 bytes, twice the size on 32-bit Windows.

Pointer types

Delphi/32

Delphi/64

Pointer

4 bytes

8 bytes

string

class instance

class reference

interface

AnsiString

WideString

UnicodeString

procedure pointer

dynamic array

PAnsiChar

PWideChar

PChar

procedure of object

On 64-bit Windows, the alignment for a procedure of object is 16 bytes, twice the size on 32-bit Windows.

procedure of object 8 bytes 16 bytes
  8 byte align 8 byte align Known as closure type

Floating point types (including the Extended data type)

The Extended type has 2 bytes' worth less precision on 64-bit Windows.

For more information, see The Extended Data Type Is 2 Bytes Smaller on 64-bit Windows Systems.

Floating point types

Delphi/32

Delphi/64

Comments

Single

4 bytes

Double

8 bytes

Real

8 bytes

Extended

10 bytes

8 bytes

TExtended80Rec has 10 bytes on Win64

Real48

6 bytes

Comp

8 bytes

Currency

8 bytes

Other types

On Win64, file size has increased.

Other types

Delphi/32

Delphi/64

Comments

Boolean

1 byte

ByteBool

1 byte

WordBool

2 bytes

LongBool

4 bytes

AnsiChar

1 byte

WideChar

2 bytes

Char

2 bytes

ShortString

256 bytes

string[N]

N+1 bytes

Variant/OleVariant

16 bytes

24 bytes

File

592 bytes

616 bytes

Text/TextFile

730 bytes

754 bytes

720 bytes in XE release

Constants

Constants

Delphi/32

Delphi/64

MaxInt

$7fffffff

MaxLongInt

$7fffffff