#undef

The general form of this directive is:

	#undef identifier

The #undef directive undoes the #define directive. That is, it removes 'identifier' (and of course its 'substitution_text' - if any) from the compiler's list of #define substitutions. From the point in a source file after a #undef directive it is as though the #define directive never was given.

If the 'identifier' of this directive has not previously been #define'd, this is not an error. It is just a way to be sure that no substitution will occur for the identifier.

If you want to change what a given identifier will be substituted by, it is necessary to first #undef it. It is not legal to #define again while it already has a definition. Some compilers will allow an identifier to be #define'd multiple times with the identical substitution_text, but will give a warning or error if the substitution_text differs. If only a warning is given, then you may or may not have succeeded in changing the substitution_text, i.e. the first might still be the substituted_text. What happens is defined to be undefined.


© 1991-2008 Prem Sobel. All Rights Reserved.