pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/DefaultRyan/cpp-docs/blob/master/docs/preprocessor/hash-undef-directive-c-cpp.md

1af.css" /> cpp-docs/docs/preprocessor/hash-undef-directive-c-cpp.md at master · DefaultRyan/cpp-docs · GitHub
Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 2.02 KB

File metadata and controls

44 lines (30 loc) · 2.02 KB
title #undef directive (C/C++)
ms.date 08/29/2019
f1_keywords
#undef
helpviewer_keywords
#undef directive
undef directive (#undef)
preprocessor, directives
ms.assetid 88900e0e-2c19-4a63-b681-f3d3133c24ca

#undef directive (C/C++)

Removes (undefines) a name previously created with #define.

Syntax

#undef identifier

Remarks

The #undef directive removes the current definition of identifier. Consequently, subsequent occurrences of identifier are ignored by the preprocessor. To remove a macro definition using #undef, give only the macro identifier, not a parameter list.

You can also apply the #undef directive to an identifier that has no previous definition. This ensures that the identifier is undefined. Macro replacement isn't 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. For more information, see The #if, #elif, #else, and #endif directives.

In the following example, the #undef directive removes definitions of a symbolic constant and a macro. Note that only the identifier of the macro is given.

#define WIDTH 80
#define ADD( X, Y ) ((X) + (Y))
.
.
.
#undef WIDTH
#undef ADD

Microsoft Specific

Macros can be undefined from the command line using the /U option, followed by the macro names to be undefined. The effect of issuing this command is equivalent to a sequence of #undef macro-name statements at the beginning of the file.

END Microsoft Specific

See also

Preprocessor directives

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy