Show: Delphi C++
Display Preferences

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

From RAD Studio
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 Windows 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

ShortInt

Byte

1 byte

SmallInt

Word

2 bytes

LongInt

LongWord

4 bytes

FixedInt

FixedUInt

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 Delphi/32 Delphi/64 Comments
Size 8 bytes 16 bytes
Alignment 8 bytes 16 bytes 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 than on 32-bit Windows (8 bytes vs 10 bytes)..

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

C++Builder 32-bit and 64-bit Windows built-in type sizes

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

Note: In order to use members of the System unit (such as System::Byte), you need to #include <System.hpp>.

Integral types

On Win64, System::NativeInt/ssize_t is twice the size of the Win32 System::NativeInt/ssize_t.
Likewise, System::NativeUInt/ssize_t is twice the size of the Win32 System::NativeUInt/size_t.

Signed Integer

Unsigned Integer

C++/32

C++/64

Comments

signed char

System::Byte, unsigned char

1 byte

System::Smallint, short

System::Word, unsigned short

2 bytes

System::LongInt, signed long

System::LongWord, unsigned

4 bytes

System::Integer, int

System::Cardinal, unsigned int

4 bytes

System::Int64, unsigned __int64, long long

System::UInt64, unsigned __int64, unsigned long long

8 bytes

System::NativeInt, ssize_t

System::NativeUInt, size_t

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

C++/32

C++/64

System::Pointer, void*

4 bytes

8 bytes

System::String, System::UnicodeString

System::TObject

System::TClass

System::IInterface, System::DelphiInterface

System::AnsiString, System::AnsiStringT<code-page>

System::WideString

System::UnicodeString

System::DynamicArray

System::PAnsiChar

System::PWideChar

System::PChar

__closure

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

__closure 8 bytes 16 bytes

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

C++/32

C++/64

Comments

System::Single, float

4 bytes

System::Double, double

8 bytes

System::Extended, long double

10 bytes

8 bytes

TExtended80Rec has 10 bytes on Win64

Real48

Not Supported

System::Comp

8 bytes

System::Currency

8 bytes

Other types

On Win64, file size has increased.

Other types

C++/32  

C++/64  

Comments   

System::Boolean, bool

1 byte

System::ByteBool, unsigned char

1 byte

System::WordBool, unsigned short

2 bytes

System::LongBool, unsigned int

4 bytes

System::AnsiChar, char

1 byte

System::WideChar, wchar_t

2 bytes

System::Char, wchar_t (Windows), char16_t (OSX)

2 bytes

System::ShortString

256 bytes

Variant / OleVariant

16 bytes

24 bytes

Constants

Constants

C++/32  

C++/64  

MaxInt

$7fffffff

MaxLongInt

$7fffffff

See Also

Personal tools
In other languages
Previous Versions
Assistance