64-bit Windows Data Types Compared to 32-bit Windows Data Types
Contents
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 |
|---|---|---|---|
|
1 byte | |||
|
2 bytes | |||
|
4 bytes | |||
|
4 bytes | |||
|
4 bytes | |||
|
8 bytes | |||
|
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 |
|---|---|---|
|
4 bytes |
8 bytes | |
|
class instance | ||
|
class reference | ||
|
interface | ||
|
procedure pointer | ||
|
dynamic array | ||
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 |
|---|---|---|---|
|
4 bytes |
|||
|
8 bytes |
|||
|
8 bytes |
|||
|
10 bytes |
8 bytes |
TExtended80Rec has 10 bytes on Win64 | |
|
6 bytes |
|||
|
8 bytes |
|||
|
8 bytes |
|||
Other types
On Win64, file size has increased.
|
Other types |
Delphi/32 |
Delphi/64 |
Comments |
|---|---|---|---|
|
1 byte |
|||
|
1 byte |
|||
|
2 bytes |
|||
|
4 bytes |
|||
|
1 byte |
|||
|
2 bytes |
|||
|
2 bytes |
|||
|
256 bytes |
|||
|
string[N] |
N+1 bytes |
||
|
16 bytes |
24 bytes | ||
|
592 bytes |
616 bytes |
||
|
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 |
|---|---|---|---|---|
|
1 byte |
||||
|
2 bytes |
||||
|
System::LongWord, unsigned |
4 bytes |
|||
|
4 bytes |
||||
|
8 bytes |
||||
|
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::AnsiString, System::AnsiStringT<code-page> | ||
__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 |
|---|---|---|---|
|
4 bytes |
|||
|
8 bytes |
|||
|
System::Extended, long double |
10 bytes |
8 bytes |
TExtended80Rec has 10 bytes on Win64 |
|
Not Supported |
|||
|
8 bytes |
|||
|
8 bytes |
|||
Other types
On Win64, file size has increased.
|
Other types |
C++/32 |
C++/64 |
Comments |
|---|---|---|---|
|
1 byte |
|||
|
1 byte |
|||
|
2 bytes |
|||
|
4 bytes |
|||
|
1 byte |
|||
|
2 bytes |
|||
|
System::Char, wchar_t (Windows), char16_t (OSX) |
2 bytes |
||
|
256 bytes |
|||
|
16 bytes |
24 bytes | ||
Constants
|
Constants |
C++/32 |
C++/64 |
|---|---|---|
|
MaxInt |
$7fffffff | |
|
MaxLongInt |
$7fffffff | |