<?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[Wann funktioniert inline bei einer Funktion nicht?]]></title><description><![CDATA[<p>Hallo</p>
<p>ich beschäftige mich zurzeit ein wenig mit den grundlegenden Dingen von C++ und habe die &quot;Vorzüge&quot; von inline kennengelernt. Mir ist bewusst, dass bei kleinen Funktionen inline Sinn macht, frage mich aber wo da die Grenze ist ob alle Funktionen inlined werden können?</p>
<p>Mein Xcode inlined praktisch alles, was mir in denn Sinn gekommen ist (rekursive Funktionen, Funktionen mit statischen Variablen)...</p>
<p>Gibt es Funktionen, die der Compiler gar nicht als inline akzeptiert und mit einer Fehlermeldung quittiert oder macht er dann automatisch eine statische Funktion daraus?</p>
<p>Danke &amp; Gruss</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/275576/wann-funktioniert-inline-bei-einer-funktion-nicht</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 20:07:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/275576.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Oct 2010 13:40:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Sun, 17 Oct 2010 13:40:19 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>ich beschäftige mich zurzeit ein wenig mit den grundlegenden Dingen von C++ und habe die &quot;Vorzüge&quot; von inline kennengelernt. Mir ist bewusst, dass bei kleinen Funktionen inline Sinn macht, frage mich aber wo da die Grenze ist ob alle Funktionen inlined werden können?</p>
<p>Mein Xcode inlined praktisch alles, was mir in denn Sinn gekommen ist (rekursive Funktionen, Funktionen mit statischen Variablen)...</p>
<p>Gibt es Funktionen, die der Compiler gar nicht als inline akzeptiert und mit einer Fehlermeldung quittiert oder macht er dann automatisch eine statische Funktion daraus?</p>
<p>Danke &amp; Gruss</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966700</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966700</guid><dc:creator><![CDATA[Airlike]]></dc:creator><pubDate>Sun, 17 Oct 2010 13:40:19 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Sun, 17 Oct 2010 13:43:48 GMT]]></title><description><![CDATA[<p>Theoretisch kannst du überall inline vor setzen.. Letztendlich entscheidet der Compiler was er inline setzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966702</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966702</guid><dc:creator><![CDATA[NEO.PIXEL]]></dc:creator><pubDate>Sun, 17 Oct 2010 13:43:48 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Sun, 17 Oct 2010 13:45:49 GMT]]></title><description><![CDATA[<p>Der Compiler entscheidet i.d.R. selbständig, ob eine Funktion direkt als inline übersetzt wird oder nicht.<br />
In den Projekteinstellungen kann man das Verhalten aber anpassen, sodass er bspw. nur mit inline gekennzeichnete Funktionen so behandelt, dies ist aber nicht zu empfehlen.<br />
Per __forceinline kann man Microsoft Compiler dazu bewegen, auch Funktionen zu inlinen, bei denen er das von sich aus nicht machen würde.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966703</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966703</guid><dc:creator><![CDATA[Vicious Falcon]]></dc:creator><pubDate>Sun, 17 Oct 2010 13:45:49 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Sun, 17 Oct 2010 14:07:22 GMT]]></title><description><![CDATA[<p>danke für die schnellen Antworten. Ich sehe also gar nicht bewusst, wenn der Compiler sich dazu entscheiden würde, etwas doch nicht inline zu verwenden. Gut zu wissen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966715</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966715</guid><dc:creator><![CDATA[Airlike]]></dc:creator><pubDate>Sun, 17 Oct 2010 14:07:22 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Sun, 17 Oct 2010 14:13:33 GMT]]></title><description><![CDATA[<p>geht das nicht auch mit</p>
<pre><code class="language-cpp">__inline void foo();
</code></pre>
<p>?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966719</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Sun, 17 Oct 2010 14:13:33 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Sun, 17 Oct 2010 14:16:04 GMT]]></title><description><![CDATA[<p>edit: Ach, es geht ausdrücklich um den MS-Compiler. Dann war die Aufforderung sich an den Standard zu halten die hier stand nicht nötig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966722</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966722</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 17 Oct 2010 14:16:04 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Sun, 17 Oct 2010 15:13:22 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>edit: Ach, es geht ausdrücklich um den MS-Compiler.</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> Xcode verwendet soweit ich weiss GCC als Compiler.</p>
<blockquote>
<p>Dann war die Aufforderung sich an den Standard zu halten die hier stand nicht nötig.</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966750</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sun, 17 Oct 2010 15:13:22 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Sun, 17 Oct 2010 15:15:57 GMT]]></title><description><![CDATA[<p>Vicious Falcon schrieb:</p>
<blockquote>
<p>Per __forceinline kann man Microsoft Compiler dazu bewegen, auch Funktionen zu inlinen, bei denen er das von sich aus nicht machen würde.</p>
</blockquote>
<p>Selbst mit __forceinline kann MSVC nicht alles inlinen, und IIRC bekommt man auch trotz __forceinline keine Warning wenn er es nicht kann. __forceinline deaktiviert quasi nur den Check ob es &quot;schlau&quot; wäre eine Funktion zu inlinen. Die diversen KO-Kriterien bleiben natürlich aktiv, denn was nicht geht geht halt nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966751</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966751</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sun, 17 Oct 2010 15:15:57 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Sun, 17 Oct 2010 15:33:17 GMT]]></title><description><![CDATA[<p>Klar, es gibt einige Einschränkungen im Gebrauch von __forceinline. Wenn der Compiler dies nicht durchführt, generiert er eine Warnung ( Level 1 , 4714).<br />
Die Einschränkungen sind aber überschaubar:<br />
- Debugversion<br />
- rekursive Funktion<br />
- variable Argumentenliste<br />
- inline asm<br />
- virtuelle Funktion<br />
- einige Spezialfälle<br />
Die &quot;cost/benefit analysis&quot; wird in anderen Fällen komplett übergangen. Es macht natürlich keinen Sinn, eine mehrere Tausend Zeilen umfassende Funktion inlinen zu wollen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966753</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966753</guid><dc:creator><![CDATA[Vicious Falcon]]></dc:creator><pubDate>Sun, 17 Oct 2010 15:33:17 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Mon, 18 Oct 2010 02:37:29 GMT]]></title><description><![CDATA[<blockquote>
<p>Wann funktioniert inline bei einer Funktion nicht?</p>
</blockquote>
<blockquote>
<p>Letztendlich entscheidet der Compiler was er inline setzt.</p>
</blockquote>
<blockquote>
<p>Der Compiler entscheidet i.d.R. selbständig, ob eine Funktion direkt als inline übersetzt wird oder nicht</p>
</blockquote>
<p>Ich finde diese Formulierungen alle sehr unglücklich gewählt. Inline funktioniert immer bei einer Funktion. Das heißt aber nicht, dass die Funktion immer &quot;geinlined&quot; werden kann. Sie ist trotzdem eine &quot;inline-Funktion&quot; bezüglich der &quot;One Definition Rule&quot;. Der Compiler darf das Schlüsselwort auch nicht einfach ignorieren. Er darf aber das eigentliche &quot;Inlining&quot; (also das Einfügen von Progammcode einer Funktion in eine andere Funktion) sein lassen. Trotzdem verändert das Schlüsselwort inline (bzw das Definieren von Funktionen innerhalb von Klassendefinitionen) garantiert die Semantik des Programms. Wie unterscheiden bei der &quot;One Definition Rule&quot; zwischen &quot;normalen&quot; Funktionen und &quot;Inline-Funktionen&quot;. Ob da eine Funktion wirklich &quot;geinlined&quot; wird, ist da eigentlich unwichtig. Trotzdem hat eine Funktion diese Eigenschaft. Sie ist entweder eine inline-Funktion oder nicht -- abhängig davon, wie sie deklariert wird bzw wo sie definiert wird. Ich hoffe es ist klar, wie das gemeint ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966937</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966937</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Mon, 18 Oct 2010 02:37:29 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Mon, 18 Oct 2010 11:57:51 GMT]]></title><description><![CDATA[<p>und nicht vergessen.</p>
<p>schreibst du die methoden defintion gleich bei der klassen deklaration hin ist die methode implizit inline.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967051</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967051</guid><dc:creator><![CDATA[ConfusedGuy]]></dc:creator><pubDate>Mon, 18 Oct 2010 11:57:51 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Mon, 18 Oct 2010 20:16:14 GMT]]></title><description><![CDATA[<p>Vicious Falcon schrieb:</p>
<blockquote>
<p>Klar, es gibt einige Einschränkungen im Gebrauch von __forceinline. Wenn der Compiler dies nicht durchführt, generiert er eine Warnung ( Level 1 , 4714).</p>
</blockquote>
<p>OK, sorry, das hatte ich falsch in Erinnerung.</p>
<blockquote>
<p>Die Einschränkungen sind aber <strong>überschaubar</strong>:<br />
- Debugversion<br />
- rekursive Funktion<br />
- variable Argumentenliste<br />
- inline asm<br />
- virtuelle Funktion<br />
<strong>- einige Spezialfälle</strong></p>
</blockquote>
<p>ROFL <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967306</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967306</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Mon, 18 Oct 2010 20:16:14 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Mon, 18 Oct 2010 20:44:11 GMT]]></title><description><![CDATA[<p>Stimmt, wenn ich das jetzt so lese &quot;Hand -&gt; Stirn -&gt; Patch*&quot; :p</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967324</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967324</guid><dc:creator><![CDATA[Vicious Falcon]]></dc:creator><pubDate>Mon, 18 Oct 2010 20:44:11 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Mon, 18 Oct 2010 21:27:54 GMT]]></title><description><![CDATA[<p>Ich glaube nicht, daß inline asm das Inlinen verhindert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967342</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967342</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Mon, 18 Oct 2010 21:27:54 GMT</pubDate></item><item><title><![CDATA[Reply to Wann funktioniert inline bei einer Funktion nicht? on Mon, 18 Oct 2010 22:07:45 GMT]]></title><description><![CDATA[<p>Ich hatte blöderweise nur den ersten Teil geschrieben</p>
<blockquote>
<p>The function uses inline assembly and is not compiled with /Og, /Ox, /O1, or /O2).</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1967352</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967352</guid><dc:creator><![CDATA[Vicious Falcon]]></dc:creator><pubDate>Mon, 18 Oct 2010 22:07:45 GMT</pubDate></item></channel></rss>