Preprocessor directive that removes the current definition of a constant or macro that was previously defined using the #define directive.
Identifier of the constant or macro to remove the definition of. If you are undefining a macro, provide only the identifier, not the parameter list.
You can apply the #undef directive to an identifier that has no previous definition; this ensures that the identifier is undefined. Macro replacement is not performed within #undef statements.
The #undef directive is typically paired with a #define directive to create a region in a source program in which an identifier has a special meaning. For example, a specific function of the source program can use manifest constants to define environment-specific values that do not affect the rest of the program. The #undef directive also works with the #if directive to control conditional compilation of the source program.
Constants and macros can be undefined from the command line using the /U option, followed by the identifiers to be undefined. This is equivalent to adding a sequence of #undef directives at the beginning of the source file.
The following example shows how to use the #undef directive to remove definitions of a symbolic constant and a macro.
#define WIDTH 80 #define ADD( X, Y ) (X) + (Y) #undef WIDTH #undef ADD
- Preprocessor Directives (DirectX HLSL)
- #define Directive (DirectX HLSL)
- #if, #elif, #else, and #endif Directives (DirectX HLSL)
Build date: 11/16/2013