DIRECTIVEPublished
#undef
#undef <identificador>Removes an active definition from the point where the directive appears.
Overview
#undef cancels an identifier previously created by #define. After it, #ifdef no longer sees the symbol as defined, and the same name may be defined again.
Syntax
#undef <identificador>Temporary symbol
#define MODO_TESTE
#ifdef MODO_TESTE
#define PREFIXO_LOG "[TESTE] "
#endif
#undef MODO_TESTE
User Function ExUndef()
#ifdef MODO_TESTE
ConOut("Este trecho não será compilado")
#endif
ReturnExpected result
After #undef, the following conditional block is discarded.
- Use #undef when a symbol is needed in only part of a source unit.
- Removal affects only lines processed after the directive.
- #undef does not free runtime memory because the definition was not a variable.
- Repeated redefinitions reduce readability.
