1.1 Introduction

Free Pascal supports compiler directives in the source file: Basically the same directives as in Turbo Pascal, Delphi and Mac OS pascal compilers. Some are recognized for compatibility only, and have no effect.

A compiler directive is always specified as a comment using curly braces:

{$DIRECTIVE [value]}

The older (* *) notation, or the C++ notation // cannot be used for directives.

The fact that a directive is specified as a comment means that it is not a pascal instruction. That in turn means that if a non-existing directive is specified, the compiler does not give an error, it just gives a warning about an invalid/unknown directive.

There is a distinction between local and global directives:

Some directives can only take a boolean value, a ’+’ to switch them on, or a ’-’ to switch them off. These directives are also known as switches. Many switches have a long form also. If they do, then the name of the long form is given also.

For long switches, the + or - character to switch the option on or off, may be replaced by the ON or OFF keywords.

Thus {$I+} is equivalent to {$IOCHECKS ON} or {$IOCHECKS +} and {$C-} is equivalent to {$ASSERTIONS OFF} or {$ASSERTIONS -}

The long forms of the switches are the same as their Delphi counterparts.

It is worth mentioning that when defaults are indicated, this means defaults in the absence of a configuration file. The configuration files distributed with FPC will change some of the defaults mentioned here.