Variable types: conversions, etc

  Type Assignment: type checking, conversions, memory management, etc When goes out of scope In expression with operators
At right can be Comments
in
tr
in
si
c
 
ty
pe
s
int any, except structures from str and lpstr receives string pointer. From BSTR and VARIANT gets numeric value (converts from string if need).   int
byte any, except structures the same   int
word any, except structures the same   int
long any, except structures the same   long
double any, except structures the same  double
lpstr strings (lpstr, str, BSTR, VARIANT(BSTR)), byte*, 0 from str and lpstr receives pointer value. BSTR is converted to a hidden local str variable.   lpstr or unsigned int
str any, except structures copies strings, converts numeric types to string frees string lpstr or unsigned int
 
O
L
E
 
t
y
p
e
s
FLOAT intrinsic and OLE types converts strings to numeric   double
DATE intrinsic and OLE types the same   double
CY intrinsic and OLE types the same   double
DECIMAL intrinsic and OLE types the same   double
BSTR intrinsic and OLE types copies strings, converts numeric types to string frees string double
VARIANT any, except structures copies all data, internally calls AddRef, Release, QueryInterface, etc. frees/Releases all data double
ARRAY ARRAY of the same type, VARIANT, strings copies all elements and associated data, calls required functions, etc the same cannot be used
  structure structure of the same type copies all data, calls required functions, etc the same cannot be used
  interface pointer interface pointer of the same type, 0, IUnknown, IDispatch, VARIANT Calls AddRef. Calls Release on previous interface pointer. If type differs, calls QueryInterface. calls Release cannot be used
po
in
te
rs
pointer pointer of the same type, 0, byte* function parameter of reference type also is pointer   pointer or unsigned int
byte* pointer of any type, 0, interface pointer, str, lpstr similar as void* in C, or Any in VB   pointer or unsigned int
reference the same as variable the same as variable does nothing the same as variable

 

 Columns:

1. Groups of variable types.

2. Variable type or types.

3. Types that are allowed at right side of assignment operation when at left side is variable of type from column 2. Assignment operation occurs when using operator =, passing argument to function, returning from function (ret).

4. Comments.

5. This column shows how are released associated memory when variable is destroyed (goes out of scope).

6. This column shows how variable is interpreted in expression with operators.

 

Notes:

1. Type checking is more strict with function arguments, and less strict with = and ret.

2. When a str, BSTR, VARIANT, ARRAY or interface pointer variable is a parameter or return value of a function (except user-defined functions), QM does not copy the associated data and does not call AddRef (the function does it itself, if necessary).

3. A structure is a user-defined type other that listed in this table.