Data Type Conversions
Each programming language defines certain types and containers for data. Most of these data types, especially the primitives, map easily to other programming languages. Some data types, however, have no equivalent in another language and cannot be converted.
For specific information about data types not recognized by your programming language, see the following topics:
The following table lists conversions between programming languages for common data types.
C++ | Visual Basic | Java | Contains |
---|---|---|---|
signed char |
Not supported |
byte |
1-byte signed integer (VT_I1, [T]) |
unsigned char |
Byte |
Not supported |
1-byte unsigned integer (VT_UI1, [V][T][P][S]) |
unsigned char |
Character |
char |
2-byte Unicode character (VT_UI2, [T][P]) |
short |
Integer |
short |
2-byte signed integer (VT_I2, [V][T][P][S]) |
unsigned short |
Not supported |
Not supported |
2-byte unsigned integer (VT_UI2, [T][P]) |
int |
Long |
int |
4-byte signed integer (VT_I4, [V][T][P][S]) |
unsigned int |
Not supported |
Not supported |
4-byte unsigned integer (VT_UI4, [T][P]) |
__int64 |
Not supported |
long |
8-byte signed integer (VT_I8, [T][P]) |
unsigned __int64 |
Not supported |
Not supported |
8-byte unsigned integer (VT_UI8, [T][P]) |
float |
Single |
float |
4-byte floating-point number (VT_R4, [V][T][P][S]) |
double |
Double |
double |
8-byte floating-point number (VT_R8, [V][T][P][S]) |
BSTR |
String |
java.lang.String |
Automation string (VT_BSTR, [V][T][P][S]) |
BOOL |
Boolean |
boolean |
Boolean (VT_BOOL, [V][T][P][S]) |
VARIANT |
Variant |
com.ms.com.Variant |
VARIANT FAR* (VT_VARIANT, [V][T][P][S]) |
IUnknown |
object |
com.ms.com.IUnknown |
IDispatch interface pointer (VT_DISPATCH, [V][T][P][S]) |
DATE |
Date |
com.ms.com.Variant |
Date (VT_DATE, [V][T][P][S]) |
CURRENCY |
Currency |
com.ms.com.Variant |
Currency (VT_CY, [V][T][P][S] or VT_DECIMAL, [V][T][S]) |
For information about VARTYPE values and how to use them, see the topic IDispatch Data Types and Structures.
The data type conversions between scripting languages are simpler than those for programming languages. JScript and JavaScript both support the same data types, and VBScript supports only a single data type, Variant. Thus, all JScript and JavaScript data types become Variant types when converted to VBScript. When you convert VBScript to JScript or JavaScript, the Variant types become numbers, strings, Boolean values, and so on.