Alias Definitions

The compiler supports the definition of aliases (see usage in Use the Defines List).
An alias is a unique identifier that can be used in programs to replace another text. Definitions are typically used to replace a constant expression and facilitate the maintenance of programs.

There are three levels of definitions:

  • Common to all the projects present on your machine
  • Global to all programs within your project
  • Local to one program

Local definitions are edited together with the corresponding program.

Definitions are entered in a text editor. Each definition must be entered on one line of text according to the following syntax:

#define Identifier Equivalence (* comments *)

Below are some examples:

#define OFF   FALSE          (* redefinition of FALSE constant *)
#define PI    3.14           (* numerical constant *)
#define ALARM (bLevel > 100) (* complex expression *)

You can use a definition within the contents of another definition. The definition used in the other one must be declared first. Below is an example:

#define PI     3.14
#define TWOPI  (PI * 2.0)

Note that a definition can be empty, for example:

#define CONDITION

The defined word can be used for directing the conditional compiling directives.

The use of definitions can disturb the program monitoring and make error reports more complex. It is recommended to restrict the use of definitions to simple expressions that do not risk creating a misunderstanding when reading or debugging a program.