Compiler Directive - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Compiler Directive.
Encyclopedia Article

Compiler Directive - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Compiler Directive.
This section contains 218 words
(approx. 1 page at 300 words per page)

A compiler directive is a special symbol or sequence of symbols in a computer program's source code that tells the compiler to carry out some action; the compiler directive is not, however, part of the computer program itself.

The most common and obvious compiler directives appear in C and C++, and they always begin with the # sign. The ones that appear most frequently are the "#define" and "#include" directives. Other common directives in C and C++ are #ifdef, #else, #ifndef, and #endif.

The compiler will interpret the directives during the pre-processor stage, which always runs before the compiler proper gets to parse and check the code. The pre-processor usually writes its own output to a temporary file and the compiler actually reads its input from that rather than direct from the source files themselves. In truth, compiler directive is something of a misnomer in C and C++ because the compiler never actually gets to see them at all.

Java and Perl also have a number of compiler directives that give the compiler instructions or information on what to do or what it must have in order to complete its job. The "import" statement in Java is analogous to the "#include" directive in C and C++, as are the "uses" and "require" directives in Perl.

This section contains 218 words
(approx. 1 page at 300 words per page)
Copyrights
Gale
Compiler Directive from Gale. ©2005-2006 Thomson Gale, a part of the Thomson Corporation. All rights reserved.