What is conditional compiling?

Showing Answers 1 - 2 of 2 Answers

Bhushan Attarde

  • Jan 22nd, 2007
 

There are certain directives available in c , which allows selective compilation of our code depending upon

certain conditions. In short the compilation of that code depends on the condition specified in directives. this is

conditional compiling.

for ex:

 #ifdef  NUM
/* compile these lines if NUM is defined */
#endif

  Was this answer useful?  Yes

fcawad_03

  • Feb 18th, 2007
 

Conditional Compilation:::::Conditional compilation is the process of selecting which code to compile and which code to not compile. (In C and C++, conditional compilation is done with the preprocessor directives #if / #else / #endif.) ConditionalDeclaration: Condition DeclarationBlock Condition DeclarationBlock else DeclarationBlock Condition : DeclarationsDeclarationBlock: Declaration { Declarations } { }Declarations: Declaration Declaration DeclarationsConditionalStatement: Condition NoScopeNonEmptyStatement Condition NoScopeNonEmptyStatement else NoScopeNonEmptyStatementIf the Condition is satisfied, then the following DeclarationBlock or Statement is compiled in. If it is not satisfied, the DeclarationBlock or Statement after the optional else is compiled in. Any DeclarationBlock or Statement that is not compiled in still must be syntactically correct. No new scope is introduced, even if the DeclarationBlock or Statement is enclosed by { }. ConditionalDeclarations and ConditionalStatements can be nested.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions