<?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[Include Guards]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich hab nun des öfteren schon folgendes gesehen:</p>
<pre><code class="language-cpp">#ifndef __FOOBAR_H_
#define __FOOBAR_H_

#if ( _MSC_VER &gt; 1000 )
  #pragma once
#endif

/**
  some stuff
*/

#endif
</code></pre>
<p>Nun meine Frage: Was macht das für einen Sinn? Include Guards und #pragma once erfüllen ja den selben Zweck, außer das #pragma once nicht zwangsläufig auf jedem Compiler funktionieren muss.</p>
<p>Also verwendet man das eine oder das andere, aber warum beides? Das #pragma once wird ja dank Include Guards sowiso ignoriert, bei doppeltem includieren? Oder seh ich das falsch?</p>
<p>Viele Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/180636/include-guards</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 20:46:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/180636.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 04 May 2007 20:40:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Include Guards on Fri, 04 May 2007 21:10:44 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich hab nun des öfteren schon folgendes gesehen:</p>
<pre><code class="language-cpp">#ifndef __FOOBAR_H_
#define __FOOBAR_H_

#if ( _MSC_VER &gt; 1000 )
  #pragma once
#endif

/**
  some stuff
*/

#endif
</code></pre>
<p>Nun meine Frage: Was macht das für einen Sinn? Include Guards und #pragma once erfüllen ja den selben Zweck, außer das #pragma once nicht zwangsläufig auf jedem Compiler funktionieren muss.</p>
<p>Also verwendet man das eine oder das andere, aber warum beides? Das #pragma once wird ja dank Include Guards sowiso ignoriert, bei doppeltem includieren? Oder seh ich das falsch?</p>
<p>Viele Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1278992</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1278992</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Fri, 04 May 2007 21:10:44 GMT</pubDate></item><item><title><![CDATA[Reply to Include Guards on Fri, 04 May 2007 21:00:41 GMT]]></title><description><![CDATA[<p>Hm, ok... Wer lesen kann ist klar im Vorteil:</p>
<blockquote>
<p>Specifies that the file, in which the pragma resides, will be included <strong>(opened)</strong> only once by the compiler in a build. A common use for this pragma is the following:</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1278998</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1278998</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Fri, 04 May 2007 21:00:41 GMT</pubDate></item><item><title><![CDATA[Reply to Include Guards on Fri, 04 May 2007 21:02:02 GMT]]></title><description><![CDATA[<p>*stuff schreibt man mit 'u' (Um noch die letzten Uneinigkeiten aus dem Weg zu räumen!)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1278999</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1278999</guid><dc:creator><![CDATA[mikey]]></dc:creator><pubDate>Fri, 04 May 2007 21:02:02 GMT</pubDate></item><item><title><![CDATA[Reply to Include Guards on Fri, 04 May 2007 22:34:57 GMT]]></title><description><![CDATA[<p>#pragma once ist schneller, da das File nicht 2x includiert wird. Mit include Guards passiert das allerdings, und die 2. Kopie muss vom Präprozessor &quot;überlesen&quot; werden, auf der Suche nach dem #endif.<br />
#pragma once ist aber (leider) nicht Standard.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1279042</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1279042</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Fri, 04 May 2007 22:34:57 GMT</pubDate></item></channel></rss>