<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Makro &amp;quot;abstellen&amp;quot;]]></title><description><![CDATA[<p>Hoi,</p>
<p>eine kurze Makro Frage: Ich will, dass ein Makro nur im Debug Modus was macht und im Releas Modus quasi garnichts.</p>
<p>Ist das der richtige Weg:?</p>
<pre><code class="language-cpp">#if defined _DEBUG
#define FOO(X) ((X)*(X))
#elif defined NDEBUG
#define FOO(X)
#endif
</code></pre>
<p>Oder kann das zu Problemen führen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/246915/makro-quot-abstellen-quot</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 20:45:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/246915.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 03 Aug 2009 14:11:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Makro &amp;quot;abstellen&amp;quot; on Mon, 03 Aug 2009 14:11:17 GMT]]></title><description><![CDATA[<p>Hoi,</p>
<p>eine kurze Makro Frage: Ich will, dass ein Makro nur im Debug Modus was macht und im Releas Modus quasi garnichts.</p>
<p>Ist das der richtige Weg:?</p>
<pre><code class="language-cpp">#if defined _DEBUG
#define FOO(X) ((X)*(X))
#elif defined NDEBUG
#define FOO(X)
#endif
</code></pre>
<p>Oder kann das zu Problemen führen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1754582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1754582</guid><dc:creator><![CDATA[miri]]></dc:creator><pubDate>Mon, 03 Aug 2009 14:11:17 GMT</pubDate></item><item><title><![CDATA[Reply to Makro &amp;quot;abstellen&amp;quot; on Mon, 03 Aug 2009 14:13:50 GMT]]></title><description><![CDATA[<p>miri schrieb:</p>
<blockquote>
<p>Hoi,</p>
<p>eine kurze Makro Frage: Ich will, dass ein Makro nur im Debug Modus was macht und im Releas Modus quasi garnichts.</p>
<p>Ist das der richtige Weg:?</p>
<pre><code class="language-cpp">#if defined _DEBUG
#define FOO(X) ((X)*(X))
#elif defined NDEBUG
#define FOO(X)
#endif
</code></pre>
<p>Oder kann das zu Problemen führen?</p>
</blockquote>
<p>Sowas wird oft gemacht. Allerdings ist mir die von dir benutzte Syntax unbekannt.</p>
<p>ich kenne nur &quot;#ifdef&quot; und nicht &quot;#if defined&quot;...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1754587</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1754587</guid><dc:creator><![CDATA[sdasdyasdasdasd]]></dc:creator><pubDate>Mon, 03 Aug 2009 14:13:50 GMT</pubDate></item><item><title><![CDATA[Reply to Makro &amp;quot;abstellen&amp;quot; on Mon, 03 Aug 2009 14:18:56 GMT]]></title><description><![CDATA[<p>Es geht beides. Ist Geschmacksache, was man da nimmt.</p>
<p>Gruß Kimmi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1754591</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1754591</guid><dc:creator><![CDATA[kimmi]]></dc:creator><pubDate>Mon, 03 Aug 2009 14:18:56 GMT</pubDate></item><item><title><![CDATA[Reply to Makro &amp;quot;abstellen&amp;quot; on Mon, 03 Aug 2009 14:26:48 GMT]]></title><description><![CDATA[<p>Also brauch ich nicht sowas freakiges wie #define FOO(X) (void*)0<br />
?<br />
Ich frag nur, weil ich das schon paar mal gesehen hab.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1754597</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1754597</guid><dc:creator><![CDATA[miri]]></dc:creator><pubDate>Mon, 03 Aug 2009 14:26:48 GMT</pubDate></item><item><title><![CDATA[Reply to Makro &amp;quot;abstellen&amp;quot; on Mon, 03 Aug 2009 14:32:09 GMT]]></title><description><![CDATA[<p>miri schrieb:</p>
<blockquote>
<p>Also brauch ich nicht sowas freakiges wie #define FOO(X) (void*)0<br />
?<br />
Ich frag nur, weil ich das schon paar mal gesehen hab.</p>
</blockquote>
<p>Das hat anderen Zweck.</p>
<p>willst Du im Code stehen haben</p>
<pre><code class="language-cpp">if(a==5)
   LOG(&quot;a=&quot;,a);
</code></pre>
<p>dann muß im releasemode auch ein</p>
<pre><code class="language-cpp">#define LOG(x,y) {}
</code></pre>
<p>da sein.<br />
(void*)0 ist wohl seltsam. vielleicht ist ((void)0) gemeint. aber auch das ist eigentlich eine schreibweise aus dem land von C.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1754600</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1754600</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Mon, 03 Aug 2009 14:32:09 GMT</pubDate></item><item><title><![CDATA[Reply to Makro &amp;quot;abstellen&amp;quot; on Mon, 03 Aug 2009 14:34:09 GMT]]></title><description><![CDATA[<p>Was man da &quot;braucht&quot; hängt davon ab, was das Makro darstellen soll. In deinem Beispiel könnte ich mir vorstellen, dass ich <code>a = FOO(b);</code> schreiben wollte, das ginge mit der &quot;Release&quot;-Variante ja nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1754601</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1754601</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Mon, 03 Aug 2009 14:34:09 GMT</pubDate></item><item><title><![CDATA[Reply to Makro &amp;quot;abstellen&amp;quot; on Mon, 03 Aug 2009 14:35:04 GMT]]></title><description><![CDATA[<p>miri schrieb:</p>
<blockquote>
<p>Also brauch ich nicht sowas freakiges wie #define FOO(X) (void*)0<br />
?<br />
Ich frag nur, weil ich das schon paar mal gesehen hab.</p>
</blockquote>
<p>Nein. Wenn du wirklich nur möchtest, dass FOO im Release-Modus nichts macht, genügt deine Definition.</p>
<p>In anderer Hinsicht hat sie aber einen Fehler: Falls _DEBUG nicht definiert ist und NDEBUG auch nicht, bleibt FOO undefiniert. Besser so schreiben:</p>
<pre><code class="language-cli">#ifndef NDEBUG
   // Debug-Version
   #define FOO(X) ((X)*(X))
#else
   // Release-Version
   #define FOO(X)
#endif
</code></pre>
<p>NDEBUG ist das korrekte Makro, um festzustellen, ob dein Code im Debug- oder Release-Modus übersetzt wird.</p>
<p>Stefan.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1754602</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1754602</guid><dc:creator><![CDATA[DStefan]]></dc:creator><pubDate>Mon, 03 Aug 2009 14:35:04 GMT</pubDate></item><item><title><![CDATA[Reply to Makro &amp;quot;abstellen&amp;quot; on Mon, 03 Aug 2009 17:53:30 GMT]]></title><description><![CDATA[<p>Ich würde <code>((void)0)</code> nehmen. Ist &quot;tried and true&quot;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1754706</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1754706</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Mon, 03 Aug 2009 17:53:30 GMT</pubDate></item></channel></rss>