Scope of Macro Names - #undef

Syntax

A preprocessor #undef directive causes the preprocessor to end the scope of a preprocessor definition.

If the identifier is not currently defined as a macro, #undef is ignored.

You can also use the undefine(macro_name) compiler option to undefine macros. The undefine(macro_name) option does not undefine macros defined in the source code.

The following directives define BUFFER and SQR:

#define BUFFER 512
#define SQR(x) ((x) * (x))

The following directives nullify these definitions:

#undef BUFFER
#undef SQR

Any occurrences of the identifiers BUFFER and SQR that follow these #undef directives are not replaced with any replacement tokens. Once the definition of a macro has been removed by an #undef directive, the identifier can be used in a new #define.



Preprocessor Directives - An Overview


Macro Definition and Expansion - #define
Resource Compiler - #define
Resource Compiler - #undef
undefine Miscellaneous Option- undefine(macro_name)
Example of Preprocessor Directives