Syntax:
#define NewTypeName
as OldTypeName
#define NewTypeName
as {pointer to|@|^|.} OldTypeName
#define NewTypeName
as {Handle to|@@|^^|..} OldTypeName
Description:
The #define
statement is one way to create a name for a variable type (the other way to do so is to use the begin record
statement). NewTypeName
can be any new name you like that is different from the names of all existing types. OldTypeName
is the name of an existing type; this can either be a built-in type such as Rect
or int
, or a type which you created previously, in a begin record
statement or in another #define
statement. After the #define
statement, you can declare variables of the new type using dim
statements, and you can pass NewTypeName
to the sizeof
and typeof
functions.
If you use the first syntax, NewTypeName
essentially becomes a synonym for OldTypeName
. If you use the other two syntaxes, then variables of the new type are recognized as pointers or handles to structures of OldTypeName
. This is the only way to create a type name for pointers or handles to other types.
Note:
#define
is non-executable, so you can't change its effect by putting it inside a conditional execution structure such as long if...end if
.
A non-executable statement inside a #if
block will only be compiled if the condition following the #if
is met. Otherwise it will be ignored.
See Also:
begin record; sizeof; typeof; dim