Futurebasic/Language/Reference/Define

#Define edit

Statement edit

✔ Appearance ✔ Standard ✔ Console

Syntax edit

#define newTypeName as oldTypeName 
#define newTypeName as {pointer to|@|^|.} oldTypeName 
#define newTypeName as {handle to|@@|^^|..} oldTypeName 

Description edit

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.

Notes edit

#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 compile long if block will only be compiled if the condition following the if is met. Otherwise it will be ignored.

See Also edit

begin record; sizeof; typeof; dim

Language Reference