<?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[Compilerunabhängige Warning oder precompiler statement im precompiler macro]]></title><description><![CDATA[<p>Hallo zusammen!</p>
<p>Ich arbeite an einer multiplattformfähigen Anwendung und stelle mir gerade die Frage wie ich eine compilerunabhängige warning gebacken bekomme. Der Microsoftcompiler mag ja leider kein #warning.<br />
So hab ich mir das vorgestellt, aber so geht es halt mal leider gar nicht:</p>
<pre><code class="language-cpp">#ifdef _WIN32
 #define NWARN(__x__)\
  #pragma warning &quot;__x__&quot;
#else
 #define NWARN(__x__)\
  #warning &quot;__x__&quot;
#endif
</code></pre>
<p>Irgendwelche Ideen?</p>
<p>Ciao<br />
Timo</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/178649/compilerunabhängige-warning-oder-precompiler-statement-im-precompiler-macro</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 00:10:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/178649.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 13 Apr 2007 08:33:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Compilerunabhängige Warning oder precompiler statement im precompiler macro on Fri, 13 Apr 2007 08:33:15 GMT]]></title><description><![CDATA[<p>Hallo zusammen!</p>
<p>Ich arbeite an einer multiplattformfähigen Anwendung und stelle mir gerade die Frage wie ich eine compilerunabhängige warning gebacken bekomme. Der Microsoftcompiler mag ja leider kein #warning.<br />
So hab ich mir das vorgestellt, aber so geht es halt mal leider gar nicht:</p>
<pre><code class="language-cpp">#ifdef _WIN32
 #define NWARN(__x__)\
  #pragma warning &quot;__x__&quot;
#else
 #define NWARN(__x__)\
  #warning &quot;__x__&quot;
#endif
</code></pre>
<p>Irgendwelche Ideen?</p>
<p>Ciao<br />
Timo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1265110</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1265110</guid><dc:creator><![CDATA[derdasallesprogrammiert]]></dc:creator><pubDate>Fri, 13 Apr 2007 08:33:15 GMT</pubDate></item><item><title><![CDATA[Reply to Compilerunabhängige Warning oder precompiler statement im precompiler macro on Fri, 13 Apr 2007 08:46:27 GMT]]></title><description><![CDATA[<p>Das geht gar nicht - der Präprozessor kann selber keine Präprozessor-Direktiven anlegen, also müsstest du noch einen Prä-Präprozessor davorschalten, der das anpasst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1265120</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1265120</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 13 Apr 2007 08:46:27 GMT</pubDate></item><item><title><![CDATA[Reply to Compilerunabhängige Warning oder precompiler statement im precompiler macro on Fri, 13 Apr 2007 09:45:02 GMT]]></title><description><![CDATA[<p>Uih, schade, habs mir aber fast schon gedacht. Das heißt so ein Problem kann nicht gelöst werden?</p>
<p>Ich sehe oft im Code Stellen die nochmal angepackt werden müssen, da finde ich warnings zur Compilezeit ganz praktisch. Wie machen das andere?<br />
Natürlich würde zur Not auch //TODO: &lt;blabla&gt; Kommentar gehen, gibt aber zur Compilezeit nichts aus und man ist auf entsprechende IDEs für alle Plattformen angewiesen, die so ne Art TODO-Liste generieren.</p>
<p>Ciao<br />
Timo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1265160</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1265160</guid><dc:creator><![CDATA[derdasallesprogrammiert]]></dc:creator><pubDate>Fri, 13 Apr 2007 09:45:02 GMT</pubDate></item><item><title><![CDATA[Reply to Compilerunabhängige Warning oder precompiler statement im precompiler macro on Fri, 13 Apr 2007 09:49:23 GMT]]></title><description><![CDATA[<p>derdasallesprogrammiert schrieb:</p>
<blockquote>
<p>Wie machen das andere?</p>
</blockquote>
<p>Entweder sie verwenden '//TODO:...' Kommentare oder sie beschränken sich auf einen Compiler und setzen Warnmeldungen so ein, daß DIESER sie versteht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1265165</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1265165</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 13 Apr 2007 09:49:23 GMT</pubDate></item><item><title><![CDATA[Reply to Compilerunabhängige Warning oder precompiler statement im precompiler macro on Fri, 13 Apr 2007 09:51:40 GMT]]></title><description><![CDATA[<p>Gehts hier nur um Warnungen oder soll das Übersetzen abgebrochen werden bis der Mangel behoben wurde?</p>
<p>Letzteres könntest du mit &quot;static asserts&quot; lösen und an die Stelle wo das assert steht schreibst du nen Kommentar wo erklärt wird warum es schief gegangen ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1265167</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1265167</guid><dc:creator><![CDATA[lolz]]></dc:creator><pubDate>Fri, 13 Apr 2007 09:51:40 GMT</pubDate></item><item><title><![CDATA[Reply to Compilerunabhängige Warning oder precompiler statement im precompiler macro on Fri, 13 Apr 2007 09:55:53 GMT]]></title><description><![CDATA[<p>Außerdem besagt das Makro _WIN32 nicht, daß es sich um einen MS-Compiler handeln muß, sondern nur daß für Windows kompiliert wird (auch für Konsolenprogramme).</p>
<p>Du müßtest dann jeweils den kompletten Präprozessor-Block hinschreiben, z.B.</p>
<pre><code class="language-cpp">#ifdef _MSC_VER
  #pragma warning &quot;Bla bla bla&quot;
#else
  #warning &quot;Bla bla bla&quot;
#endif
</code></pre>
<p>P.S. Deine Warnings würden immer __x__ ausgeben.<br />
Der richtige PP-Befehl dafür lautet: #__x__ (NICHT &quot;__x__&quot;)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1265170</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1265170</guid><dc:creator><![CDATA[Th]]></dc:creator><pubDate>Fri, 13 Apr 2007 09:55:53 GMT</pubDate></item><item><title><![CDATA[Reply to Compilerunabhängige Warning oder precompiler statement im precompiler macro on Fri, 13 Apr 2007 12:05:08 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/9348">@Th</a>: Ach so, ja, war nur Pseudocode. Genau solche Blöcke will ich im Code eigentlich nicht haben.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/13970">@lolz</a>: Es geht nur um Warnings.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/10318">@CStoll</a>: Okay, dann also doch //TODO Kommentare... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>Danke an alle!</p>
<p>Ciao<br />
Timo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1265258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1265258</guid><dc:creator><![CDATA[derdasallesprogrammiert]]></dc:creator><pubDate>Fri, 13 Apr 2007 12:05:08 GMT</pubDate></item></channel></rss>