Compiler Directive Encyclopedia Article

Compiler Directive

The following sections of this BookRags Literature Study Guide is offprint from Gale's For Students Series: Presenting Analysis, Context, and Criticism on Commonly Studied Works: Introduction, Author Biography, Plot Summary, Characters, Themes, Style, Historical Context, Critical Overview, Criticism and Critical Essays, Media Adaptations, Topics for Further Study, Compare & Contrast, What Do I Read Next?, For Further Study, and Sources.

(c)1998-2002; (c)2002 by Gale. Gale is an imprint of The Gale Group, Inc., a division of Thomson Learning, Inc. Gale and Design and Thomson Learning are trademarks used herein under license.

The following sections, if they exist, are offprint from Beacham's Encyclopedia of Popular Fiction: "Social Concerns", "Thematic Overview", "Techniques", "Literary Precedents", "Key Questions", "Related Titles", "Adaptations", "Related Web Sites". (c)1994-2005, by Walton Beacham.

The following sections, if they exist, are offprint from Beacham's Guide to Literature for Young Adults: "About the Author", "Overview", "Setting", "Literary Qualities", "Social Sensitivity", "Topics for Discussion", "Ideas for Reports and Papers". (c)1994-2005, by Walton Beacham.

All other sections in this Literature Study Guide are owned and copyrighted by BookRags, Inc.

Compiler Directive

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.