Functions and Directives

Directive #undef Foundation

Undefines a #define directive

#undef <Symbol>
<Symbol> designates the name of a symbolic constant or pseudofunction which is to be undefined.

The directive #undef revokes a definition created via the #define directive. It can be used in the context of conditional compilation, by which the preprocessor translates different parts of a source code depending on the presence or absence of symbolic constants. This directive is also useful when it is helpful to redefine an existing constant. Without #undef, redefining an existing constant raises a compiler warning. The #undef directive makes it possible to first undefine, then redefine a particular constant. Note that this directive is recognized for #define only, not other directives.

#undef usage
// In this example the #define constant DEBUG is undefined. 

#ifdef DEBUG 
   #undef DEBUG 


   #ifdef DEBUG 
      ? "Source code with Debug Version" 
      ? "Final source code" 



If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.