Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Description of Directives
◄Compiler Directives► ◄Contents► ◄Index► ◄Help on Help►
Description
Compiler directives are specialized comments that control the
process of compiling source code. They begin with a dollar
sign and a letter. For example, the range-checking directive
looks like
{$R+}
A directive is not recognized if there are spaces or any other
characters between the '{' and the '$'. For example, QuickPascal
treats the following directive as a simple comment──range checking
is not affected:
{ $R+}
There are three categories of compiler directives:
Category Action
═══════════ ═══════════════════════════════════
Switch Turn a feature on or off
Parameter Control memory or use certain files
Conditional Compile a section of code
Switch Directives
A switch directive has a '+' or '-' after the directive letter.
Switch Scope Default Description
══════ ═════ ═══════ ════════════════════════════
$A+│- local + Align data
$B+│- local - Boolean, complete evaluation
$D+│- global + Debug information
$F+│- local - FAR calls
$I+│- local + I/O checking
$L+│- local + Local debug information
$M+│- local + Method call checking
$N+│- global - Numeric processing
$R+│- local - Range checking
$S+│- global + Stack checking
$V+│- local + VAR-string type checking
Global control directives influence an entire program file. They
must appear before the declaration portion of that file; that is,
before the keywords USES, LABEL, CONST, TYPE, FUNCTION, PROCEDURE,
or BEGIN.
Local control directives influence the action of a localized
section of code. They bracket the section of code that they
control.
Parameter-Accepting Directives
Directive Description
═════════════════════════ ═════════════════════════
$I <filename> Includes a source file
$L <filename> Links an OBJ file
$M <stack,minheap,maxheap> Memory allocation control
Conditional-Compilation Directives
Directive Description
═══════════════ ═════════════════════════════════
$DEFINE <symbol> Defines a symbol
$UNDEF <symbol> Undefines a symbol
$IFDEF <symbol> Tests if a symbol is defined
$IFNDEF <symbol> Tests if a symbol is undefined
$IFOPT <switch> Tests if a switch is on or off
$ELSE Marks the start of an alternate
section
$ENDIF Marks the end of a conditional
section
The action of conditional-compilation directives is similar to
Pascal's IF statement. However, defined symbols are not available
to a Pascal program. For example, the following code produces a
compiler error:
{$DEFINE debug}
.
.
IF debug THEN
.
.