Directive (programming)

In computer science is meant by compiler directive ( or English. Compiler directive ) inserted into the source code control instructions for the compiler. The scope and the syntax of compiler directives are different from compiler to compiler and described in the compiler documentation.

Examples

C compilers use a C preprocessor that interprets compiler directives. For example, # include to the preprocessor, the contents of the file foo.h insert at this point in the source code. With the # pragma statement feature a property is displayed to the compiler. An example of a property is the annotation of parallelizable code block, if the C compiler supported the OpenMP standard:

# pragma omp parallel for reduction ( : c )   for (int i = 0; i

In the Ada compiler directives are preceded by the keyword pragma. Thus, for example, with pragma OPTIMIZE (TIME ); the optimization program controlled.

The Haskell compiler GHC supports the setting of command line options in the source file using compiler directives. An example is the activation of ghc- Haskell language extensions with the directive is requested { - - # OPTIONS_GHC - fglasgow - exts #}.

  • Programming
199058
de