 
    
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>undef Archives - Complete, Concrete, Concise</title>
	<atom:link href="https://complete-concrete-concise.com/tag/undef/feed/" rel="self" type="application/rss+xml" />
	<link>https://complete-concrete-concise.com/tag/undef/</link>
	<description>Practical Information Without The Bloat</description>
	<lastBuildDate>Sun, 19 Jun 2011 17:34:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
	<item>
		<title>Preprocessor &#8211; the #undef Directive</title>
		<link>https://complete-concrete-concise.com/programming/c/preprocessor-the-undef-directive/</link>
		
		<dc:creator><![CDATA[richardsplanet]]></dc:creator>
		<pubDate>Sun, 19 Jun 2011 17:34:42 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[preprocessor]]></category>
		<category><![CDATA[undef]]></category>
		<category><![CDATA[understanding]]></category>
		<guid isPermaLink="false">http://complete-concrete-concise.com/programming/c/preprocessor-the-undef-directive</guid>

					<description><![CDATA[<p>Behaviour of the #undef directive is the same in both C and C++. Purpose It is used to undefine a macro. A macro is an identifier (or label) followed by replacement text. There is only a single namespace for macros. A program which redefines an existing macro is considered to be malformed &#8211; even though [&#8230;]</p>
<p>The post <a href="https://complete-concrete-concise.com/programming/c/preprocessor-the-undef-directive/">Preprocessor &#8211; the #undef Directive</a> appeared first on <a href="https://complete-concrete-concise.com">Complete, Concrete, Concise</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="c1">
<p>Behaviour of the <code>#undef</code> directive is the same in both C and C++.</p>
</div>
<h1>Purpose</h1>
<p>It is used to undefine a macro. </p>
<p>A macro is an identifier (or label) followed by replacement text.</p>
<p>There is only a single namespace for macros. A program which redefines an existing macro is considered to be malformed &#8211; even though most compilers only generate a warning instead of an error.</p>
<h1>Format</h1>
<div class="c2"><code><strong>#undef</strong> <em>MACRO_NAME </em></code></div>
<p>All preprocessor directives begin with the <code>#</code> symbol. It must be the first character on the line or the first character on the line following optional white space. </p>
<div class="c4">
<p>Some early compilers flagged an error if <code>#</code> was not the first character on the line.</p>
</div>
<p>Spaces or tabs are permitted between the <code>#</code> and <code>undef</code>, but not escape characters or other symbols or macros. The preprocessor removes whitespace and concatenates the <code>#</code> and <code>undef</code> together.</p>
<p>The following are valid uses:</p>
<pre>#undef my_macro
#    undef      my_macro
     # undef my_macro
# /* comments are whitespace */ undef my_macro</pre>
<p>The following are invalid uses:</p>
<pre>#define empty_macro
// #empty_macro is not a valid preprocessor directive
#   empty_macro undef my_macro
// #\ is not a valid preprocessor directive
# \t undef my_macro
// #" is not a valid preprocessor directive
# "" undef my_macro</pre>
<p>If the specified macro name does not exist, nothing happens.</p>
<p>If the specified macro name exists, its name, parameter list, and replacement text is removed.</p>
<p>Conceptually, macros are stored in a 3 column table:</p>
<pre>|------------|----------------|------------------|
| <strong>Macro Name</strong> | <strong>Parameter List</strong> | <strong>Replacement Text</strong> |
|------------|----------------|------------------|
| my_macro   |                | // some text     |
|------------|----------------|------------------|
| macro_2a   | a, b           | ((a)*(b))        |
|------------|----------------|------------------|</pre>
<p>When we <code>#undef</code> a macro, we remove it from the table.</p>
<p>A program is malformed if anything other than whitespace (comments count as whitespace) and a newline character follow the macro name.</p>

<p>The post <a href="https://complete-concrete-concise.com/programming/c/preprocessor-the-undef-directive/">Preprocessor &#8211; the #undef Directive</a> appeared first on <a href="https://complete-concrete-concise.com">Complete, Concrete, Concise</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
