Each Delphi compiler directive is classified as either a switch, parameter, or conditional compilation directive.
A compiler directive is a comment with a special syntax. Compiler directives can be placed wherever comments are allowed. A compiler directive starts with a $ as the first character after the opening comment delimiter, immediately followed by a name (one or more letters) that designates the particular directive. You can include comments after the directive and any necessary parameters.
Three types of directives are described in the following topics:
{$B+,R-,S-}
{$B+} {$STACKCHECKS ON} {$R- Turn off range checking} {$I TYPES.INC} {$M 32768,4096} {$DEFINE Debug} {$IFDEF Debug} {$ENDIF}
You can insert compiler directives directly into your source code. You can also change the default directives for the command-line compiler, dccil and the IDE, bds.exe.
The Project|Options dialog box contains many of the compiler directives; any changes you make to the settings there will affect all units whenever their source code is recompiled in subsequent compilations of that project. If you change a compiler switch and compile, none of your units will reflect the change; but if you Build All, all units for which you have source code will be recompiled with the new settings.
When using the command-line compiler, you can specify compiler directives on the command line; for example,
DCCIL -$R+ MYPROG
If you are working in the Code editor and want a quick way to see what compiler directives are in effect, press Ctrl+O O. You will see the current settings in the edit window at the top of your file.
Conditional Compilation
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|