<?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[Stack oder Heap - wann was?]]></title><description><![CDATA[<p>Hallo, ich habe mir einige Literatur zur Speicherallokation in C++ durchgelesen und weiß, dass ich Variablen oder Objekte im Stack speichern kann oder im Heap durch new und delete.</p>
<p>Wann sollte ich Variablen oder Objekte ganz normal deklarieren und wann mit new/delete? Das ist mir aus der bisherigen Literatur noch nicht klar geworden.</p>
<p>Dankeschön im Vorraus!</p>
<p>Viele Grüße,<br />
Sveno</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/251995/stack-oder-heap-wann-was</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 04:22:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/251995.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 13 Oct 2009 12:16:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Stack oder Heap - wann was? on Tue, 13 Oct 2009 12:16:28 GMT]]></title><description><![CDATA[<p>Hallo, ich habe mir einige Literatur zur Speicherallokation in C++ durchgelesen und weiß, dass ich Variablen oder Objekte im Stack speichern kann oder im Heap durch new und delete.</p>
<p>Wann sollte ich Variablen oder Objekte ganz normal deklarieren und wann mit new/delete? Das ist mir aus der bisherigen Literatur noch nicht klar geworden.</p>
<p>Dankeschön im Vorraus!</p>
<p>Viele Grüße,<br />
Sveno</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1791942</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1791942</guid><dc:creator><![CDATA[Sveno]]></dc:creator><pubDate>Tue, 13 Oct 2009 12:16:28 GMT</pubDate></item><item><title><![CDATA[Reply to Stack oder Heap - wann was? on Tue, 13 Oct 2009 12:21:27 GMT]]></title><description><![CDATA[<p>Immer ganz normal, außer ganz selten, zum Beispiel wenn das Array mehr als viele tausend Bytes groß ist oder wenn die Funktion Objekte erzeogen können soll, die nach Funktionsende noch leben oder für Polymorphietricks.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1791945</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1791945</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Tue, 13 Oct 2009 12:21:27 GMT</pubDate></item><item><title><![CDATA[Reply to Stack oder Heap - wann was? on Tue, 13 Oct 2009 14:15:51 GMT]]></title><description><![CDATA[<p>Mit new legt man Objekte im dynamischen Speicher ab. D.h. in dem Fall, wenn man erst zur Laufzeit des Programm entscheidet, wann und welches Objekt man erzeugen will.</p>
<p>Auf dem Stack kommen die Objekte, die man undynamisch erzeugt... also schon vor Programmstart erzeugt weiß.</p>
<p>Beispiel:</p>
<pre><code class="language-cpp">Base* foo(bool a)
{
   if(a)
      return new A;
   else
      return new B;
}
</code></pre>
<p>Das obige Beispiel zeigt sehr schön, das ich hier erst <em>zur Programmlaufzeit</em> (dynamisch) entscheiden kann, ob ein Objekt vom Typ A oder B erzeugt werden soll. Das wird mit Stackobjekten nicht funktionieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1792011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1792011</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Tue, 13 Oct 2009 14:15:51 GMT</pubDate></item><item><title><![CDATA[Reply to Stack oder Heap - wann was? on Tue, 13 Oct 2009 15:25:19 GMT]]></title><description><![CDATA[<p>Das Thema scheint in letzter Zeit beliebt zu sein:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-250825.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-250825.html</a><br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-249787.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-249787.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1792053</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1792053</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Tue, 13 Oct 2009 15:25:19 GMT</pubDate></item><item><title><![CDATA[Reply to Stack oder Heap - wann was? on Tue, 13 Oct 2009 17:44:41 GMT]]></title><description><![CDATA[<p>Vielen Dank, ihr habt mir sehr geholfen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1792147</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1792147</guid><dc:creator><![CDATA[Sveno]]></dc:creator><pubDate>Tue, 13 Oct 2009 17:44:41 GMT</pubDate></item></channel></rss>