更新,下面这table为最新的tokyo基本数据类型与C++的对照关系:
Delphi to C++ types mapping
Go Up to Support for Delphi Data Types and Language Concepts
Below is a list of Delphi data types and the corresponding C++ data types:
Delphi type | defined in sysmac.h | Platform | Corresponding C++ type |
Boolean |
|
| bool |
ShortInt | System::Int8 |
| signed char |
SmallInt |
|
| short |
Integer |
|
| int |
Int64 |
|
| __int64 |
Byte | System::Byte |
| unsigned char |
Word | System::Word |
| unsigned short |
Cardinal |
|
| unsigned |
UInt64 |
|
| unsigned __int64 |
NativeInt | System::NativeInt | 32-bit platforms | int |
64-bit Windows | __int64 | ||
64-bit iOS 64-bit Linux | long | ||
NativeUInt | System::NativeUInt | 32-bit platforms | unsigned int |
64-bit Windows | unsigned __int64 | ||
64-bit iOS 64-bit Linux | unsigned long | ||
LongInt |
| 32-bit platforms 64-bit Windows | int |
64-bit iOS 64-bit Linux | long | ||
LongWord |
| 32-bit platforms 64-bit Windows | unsigned |
64-bit iOS 64-bit Linux | unsigned long | ||
FixedInt |
|
| int |
FixedUInt |
|
| unsigned int |
Single |
|
| float |
Double |
|
| double |
Extended | System::Extended |
| long double |
Currency | System::Currency, System::CurrencyBase |
|
|
Comp | System::Comp, System::CompBase |
|
|
Real |
|
| double |
ShortString | System::ShortString, System::ShortStringBase |
|
|
OpenString | System::OpenString |
| char* const |
String | System::UnicodeString |
|
|
WideString | System::WideString |
|
|
AnsiChar |
|
| char |
Char | System::WideChar | Windows platforms | wchar_t |
Posix platforms | char16_t | ||
WideChar | System::WideChar | Windows platforms | wchar_t |
Posix platforms | char16_t | ||
File | System::file |
|
|
Text | System::TextFile |
|
|
ByteBool | System::ByteBool |
| unsigned char |
WordBool | System::WordBool |
| unsigned short |
LongBool | System::LongBool |
| int |
Real48 | not supported in C++ | ||
Pointer |
|
| void* |
PWideChar | System::WideChar* | Windows platforms | wchar_t* |
Posix platforms | char16_t* | ||
PAnsiChar |
|
| char* |
Variant | System::Variant defined in sysvari.h |
|
|
OleVariant | System::OleVariant defined in sysvari.h |
|
|
Note: 32-bit platforms include 32-bit Windows, 32-bit macOS, 32-bit iOS, and Android.
POSIX platforms include macOS, iOS, iOS-simulator, Android, and Linux.
Delphi | 数据类型 | C/C++ |
ShorInt | 8位有符号整数 | char |
Byte | 8位无符号整数 | BYTE,unsigned short |
SmallInt | 16位有符号整数 | short |
Word | 16位无符号整数 | unsigned short |
Integer,LongInt | 32位有符号整数 | int,long |
Cardinal,LongWord/DWORD | 32位无符号整数 | unsigned long |
Int64 | 64位有符号整数 | _int64 |
Single | 4字节浮点数 | float |
*Real48 | 6字节浮点数 |
|
Double | 8字节浮点数 | double |
*Extended | 10字节浮点数 | long double |
Currency | 64位货币类型 |
|
TDate/TDateTime | 8字节日期/时间 |
|
Variant,OleVariant | 16字节可变类型 | VARIANT,^Variant,^OleVariant |
Char,AnsiChar | 1字节字符 | char |
WideChar | 2字节字符 | WCHAR |
*ShortString | 短字符串 |
|
AnsiString/String | 长字符串 | ^AnsiString |
WideString | 宽字符串 | ^WideString |
PChar,PAnsiChar | NULL结束的字符串 | char* |
PWideChar | NULL结束的宽字符串 | LPCWSTR |
Boolean,ByteBool | 1字节布尔类型 | 任何1字节 |
WordBool | 2字节布尔类型 | 任何2字节 |
BOOL,LongBool | 4字节布尔类型 | BOOL |
注:有*前缀的是向前兼容类型;有^前缀的是C++Builder特有类型。 |
C/C++ | Delphi |
ABC | TABC |
ACCEL | TAccel |
ATOM | TAtom |
BITMAP | TBitMap |
BITMAPCOREHEADER | TBitmapCoreHeader |
BITMAPCOREINFO | TBitmapCoreInfo |
BITMAPFILEHEADER | TBitmapFileHeader |
BITMAPINFO | TBitmapInfo |
BITMAPINFOHEADER | TBitmapInfoHeader |
BOOL | Bool |
CBT_CREATEWND | TCBT_CreateWnd |
CBTACTIVATESTRUCT | TCBTActivateStruct |
CHAR | Char |
CHAR* | PChar |
CLIENTCREATESTRUCT | TClientCreateStruct |
COLORREF | TColorRef |
COMPAREITEMSTRUCT | TCompareItemStruct |
COMSTAT | TComStat |
CREATESTRUCT | TCreateStruct |
CTLINFO | TCtlInfo |
CTLSTYLE | TCtlStyle |
CTLtype | TCtltype |
DCB | TDCB |
DDEAACK | TDDEAck |
DDEADVISE | TDDEAdvise |
DDEDATA | TDDEData |
DDEPOKE | TDDEPoke |
DEBUGHOOKINFO | TDebugHookInfo |
DELETEITEMSTRUCT | TDeleteItemStruct |
DEVMODE | TDevMode |
DOUBLE | Double |
DRAWITEMSTRUCT | TDrawItemStruct |
DWORD | LongInt |
ENUMLOGFONT | TEnumLogFont |
EVENTMSG | TEventMsg |
FARPROC | TFarProc |
FIXED | TFixed |
FLOAT | Single |
GLYPHMETRICS | TGlyphMetrics |
HANDLE | THandle |
HANDLETABLE | THandleTable |
HARDWAREHOOKSTRUCT | THardwareHookStruct |
HELPWININFO | THelpWinInfo |
INT | Integer |
KERNINGPAIR | TKerningPair |
LOGBRUSH | TLogBrush |
LOGFONT | TLogFont |
LOGPALETTE | TLogPalette |
LOGPEN | TLogPen |
LONG | LongInt |
LONG DOUBLE | Extended |
LONG INT | LongInt |
LPSTR | PChar |
LPWSTR | PWideChar |
MAT2 | TMat2 |
MDICREATESTRUCT | TMDICreateStruct |
MEASUREITEMSTRUCT | TMeasureItemStruct |
MENUITEMTEMPLATE | TMenuItemTemplate |
MENUITEMTEMPLATEHEADER | TMenuItemTemplateHeader |
METAFILEPICT | TMetaFilePict |
METAHEADER | TMetaHeader |
METARECORD | TMetaRecord |
MINMAXINFO | TMinMaxInfo |
MOUSEHOOKSTRUCT | TMouseHookStruct |
MSG | TMsg |
MULTIKEYHELP | TMultiKeyHelp |
NCCALCSIZE_PARAMS | TNCCalcSize_Params |
NEWTEXTMETRIC | TNewTextMetric |
OFSTRUCT | TOFStruct |
OUTLINETEXTMETRIC | TOutlineTextMetric |
PAINTSTRUCT | TPaintStruct |
PALETTEENTRY | TPaletteEntry |
PANOSE | TPanose |
PATTERN | TPattern |
POINTFX | TPointFX |
PSTR | PChar |
PWSTR | PWideChar |
RASTERIZER_STATUS | TRasterizer_Status |
RGBQUAD | TRGBQuad |
RGBTRIPLE | TRGBTriple |
SEGINFO | TSegInfo |
SHORT | SmallInt |
SHORT INT | SmallInt |
SIZE | TSize |
TEXTMETRIC | TTextMetric |
TPOINT | TPoint |
TRECT | TRect |
TTPOLYCURVE | TTTPolyCurve |
TTPOLYGONHEADER | TPolygonHeader |
UINT | Word |
UNSIGNED | Word |
UNSIGNED CHAR | Byte |
UNSIGNED INT | Word |
UNSIGNED LONG | LongInt(DWORD) |
UNSIGNED LONG INT | LongInt |
UNSIGNED SHORT | Word |
UNSIGNED SHORT INT | Word |
VOID* | Pointer |
WINDOWPLACEMENT | TWindowPlacement |
WINDOWPOS | TWindowPos |
WNDCLASS | TWndClass |
WORD | Word |