Syntax
define-directive: |
<default-visibility-set> |
|
<variable-definition> |
|
<macro-definition> |
default-visibility-set:
| (define | :) private | protected | public |
variable-definition:
| (define | :) [private | protected | public] <ident> [[ <expr> ]] [[=] <expr>] |
macro-definition:
| (define | :) [private | protected | public] <ident> ( [<formal-macro-args>] ) <expr> |
formal-macro-args:
| <formal-macro-arg> [, <formal-macro-arg>]... |
formal-macro-arg:
| <by-val-arg> | <by-ref-arg> |
by-val-arg:
| [<type-id>] <ident> [= <expr>] |
by-ref-arg:
| [<type-id>] * <ident> |
type-id:
| any | int | str | func |
Description
The first syntax of the define directive sets the default visibility of further variable and macro definitions in this file.
If no visibility declaration occurs in a file, public visibility is assumed by default.
The second syntax defines a variable named ident, or assigns a value to an element of an array named ident. If none of the public, protected, or private keywords are specified, default visibility is assumed which is set by the first syntax of define directive.
The third syntax defines a macro named ident. When defining a macro there must be no whitespace between macro name and opening parenthesis, otherwise it will be treated as variable declaration.
Examples
#define MyAppName "My Program" ; define variable
#define MyAppVer GetFileVersion("MyProg.exe") ; define variable
#define MyArray[0] 15 ; assign a value to an array element
#define Multiply(int A, int B = 10) A * B ; define macro
See also
dim, undef, User defined macros, Visibility of identifiers.