Conditional Compilation

In computer programming, conditional compilation is compilation implementing methods which allow the compiler to produce differences in the executable produced controlled by parameters that are provided during compilation. This technique is commonly used when these differences are needed to run the software on different platforms, or with different versions of required libraries or hardware.

Many programming languages support conditional compilation. Typically compiler directives define or "undefine" certain variables; other directives test these variables and modify compilation accordingly. For example, not using an actual language, the compiler may be set to define "Macintosh" and undefine "PC", and the code may contain:

Section of code common to all systems
if "Macintosh" is defined:
section of code for Macintosh computer only
end if "Macintosh"
common code
if "PC" is defined:
section of code for PC computer only
end if "PC"

In C and some languages with a similar syntax, this is done using an '#ifdef' directive.

A similar procedure, using the name "conditional comment", is used by Microsoft Internet Explorer from version 5 to 9 to interpret HTML code. There is also a similar proprietary mechanism for adding conditional comments within JScript, known as conditional compilation.

Famous quotes containing the words conditional and/or compilation:

    Conditional love is love that is turned off and on....Some parents only show their love after a child has done something that pleases them. “I love you, honey, for cleaning your room!” Children who think they need to earn love become people pleasers, or perfectionists. Those who are raised on conditional love never really feel loved.
    Louise Hart (20th century)

    The United States Constitution has proved itself the most marvelously elastic compilation of rules of government ever written.
    Franklin D. Roosevelt (1882–1945)