<?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[Woher weiß delete[] die Größe?]]></title><description><![CDATA[<p>Hi!</p>
<p>Wenn ich mit new[] neue Objekte anlege und die später mit delete[] wieder lösche - woher weiß delete[] dann, wie viele Objekte das sind?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/247305/woher-weiß-delete-die-größe</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 15:37:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/247305.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 09 Aug 2009 08:21:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Woher weiß delete[] die Größe? on Sun, 09 Aug 2009 08:21:10 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Wenn ich mit new[] neue Objekte anlege und die später mit delete[] wieder lösche - woher weiß delete[] dann, wie viele Objekte das sind?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1757754</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757754</guid><dc:creator><![CDATA[Smooth Operator]]></dc:creator><pubDate>Sun, 09 Aug 2009 08:21:10 GMT</pubDate></item><item><title><![CDATA[Reply to Woher weiß delete[] die Größe? on Sun, 09 Aug 2009 08:25:56 GMT]]></title><description><![CDATA[<p>Noch etwas genauer: Ich habe nur operator new und operator delete definiert, nicht die Array-Versionen new[] und delete[]. Der Compiler ruft für new[] new und für delete[] delete auf - erzeugt und löscht auch jeweils genau die richtige Menge Speicher.</p>
<p>Compiler ist MSVC 9.0</p>
<p>Und gleich noch eine Frage: Allgemein wird für operator new wohl __cdecl als Aufrufkonvention bevorzugt, hat das einen speziellen Grund?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1757756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757756</guid><dc:creator><![CDATA[Smooth Operator]]></dc:creator><pubDate>Sun, 09 Aug 2009 08:25:56 GMT</pubDate></item><item><title><![CDATA[Reply to Woher weiß delete[] die Größe? on Sun, 09 Aug 2009 09:00:17 GMT]]></title><description><![CDATA[<p><a href="http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.14" rel="nofollow">http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.14</a> schrieb:</p>
<blockquote>
<p><em>[16.14] After p = new Fred[n], how does the compiler know there are n objects to be destructed during delete[] p?</em></p>
<p>Short answer: Magic.</p>
<p>Long answer: The run-time system stores the number of objects, n, somewhere where it can be retrieved if you only know the pointer, p. There are two popular techniques that do this. Both these techniques are in use by commercial-grade compilers, both have tradeoffs, and neither is perfect. These techniques are:</p>
<ul>
<li>Over-allocate the array and put n just to the left of the first Fred object.</li>
<li>Use an associative array with p as the key and n as the value.</li>
</ul>
</blockquote>
<p>Was das __cdecl hat, hab ich keine Idee. Es beschreibt ja nur in welcher Reihenfolge und wohin die Parameter einer Funktion übergeben werden und wer danach wieder aufräumt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1757764</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757764</guid><dc:creator><![CDATA[lagalopex]]></dc:creator><pubDate>Sun, 09 Aug 2009 09:00:17 GMT</pubDate></item><item><title><![CDATA[Reply to Woher weiß delete[] die Größe? on Sun, 09 Aug 2009 09:16:28 GMT]]></title><description><![CDATA[<p>__cdecl ist, laut msdn, einfach die Standard Aufrufskonvention für C/C++.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1757765</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757765</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Sun, 09 Aug 2009 09:16:28 GMT</pubDate></item></channel></rss>