#undef
既に定義されているマクロの定義を削除します。
説明
マクロ・プリプロセッサ指示文は、既に定義されているマクロの定義を削除します。以下の形式をとります。
#undef macro-name
macro-name は、既に定義されているマクロです。
#undef は、#define または #def1arg の呼び出しの後に続きます。これは、#ifDef および関連付けられたプリプロセッサ指示文 (#else、#endif、および #ifNDef) と連動します。
以下の例では、マクロが定義済みであること、および未定義であることを条件とするコードを示します。
#define TheSpecialPart
#ifDef TheSpecialPart
WRITE "We're in the special part of the program.",!
#endif
//
// code here...
//
#undef TheSpecialPart
#ifDef TheSpecialPart
WRITE "We're in the special part of the program.",!
#else
WRITE "We're no longer in the special part of the program.",!
#endif
#ifNDef TheSpecialPart
WRITE "We're still outside the special part of the program.",!
#else
WRITE "We're back inside the special part of the program.",!
#endif
これに対する .int コードは以下のとおりです。
WRITE "We're in the special part of the program.",!
//
// code here...
//
WRITE "We're no longer in the special part of the program.",!
WRITE "We're still outside the special part of the program.",!