Open main menu

CDOT Wiki β

Changes

Week 2

464 bytes added, 12:21, 19 May 2010
no edit summary
Another example: ''#define MAX(x, y) ((x)>(y)?(x):(y))''
 
<u>Conditional Compilation</u>
 
With conditional compilation you can tell the compiler to only compile a section of the code.
 
''#define COMPINT 1''
''#define COMPDOUBLE 2''
''#define COMP COMPINT''
 
In the code:
 
''#ifdef COMP == COMPINT''
Code
Code
code
''#endif''
 
''#ifdef COMP == COMPDOUBLE''
Code
Code
Code
''#else''
Code
Code
Code
''#endif''
 
It will only compile the first if statement and the else statement.
1
edit