<?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[Frage zu delete]]></title><description><![CDATA[<p>Wenn ich Speicher anfordere z.B</p>
<pre><code class="language-cpp">char *test= new char[4];
</code></pre>
<p>reicht es einfach</p>
<pre><code class="language-cpp">delete test;
</code></pre>
<p>aufzurufen, oder muß ich noch die 4 (Länge des erzeugten char*) irgendwie mit angeben?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/160320/frage-zu-delete</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 05:31:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/160320.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 24 Sep 2006 19:53:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Frage zu delete on Sun, 24 Sep 2006 19:53:06 GMT]]></title><description><![CDATA[<p>Wenn ich Speicher anfordere z.B</p>
<pre><code class="language-cpp">char *test= new char[4];
</code></pre>
<p>reicht es einfach</p>
<pre><code class="language-cpp">delete test;
</code></pre>
<p>aufzurufen, oder muß ich noch die 4 (Länge des erzeugten char*) irgendwie mit angeben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1143620</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1143620</guid><dc:creator><![CDATA[MisterX]]></dc:creator><pubDate>Sun, 24 Sep 2006 19:53:06 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu delete on Sun, 24 Sep 2006 19:54:46 GMT]]></title><description><![CDATA[<p>Das reicht:</p>
<pre><code class="language-cpp">delete [] test;
</code></pre>
<p>Man beachte das &quot;[]&quot;.</p>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1143623</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1143623</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Sun, 24 Sep 2006 19:54:46 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu delete on Sun, 24 Sep 2006 21:38:04 GMT]]></title><description><![CDATA[<p>wenn mit</p>
<p>new [] alloziiert mit delete [] löschen<br />
new alloziiert mit delete löschen</p>
<p>auf keinen fall die beiden mischen. das führt zu nicht definiertem verhalten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1143657</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1143657</guid><dc:creator><![CDATA[ConfusedGuy]]></dc:creator><pubDate>Sun, 24 Sep 2006 21:38:04 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu delete on Sun, 24 Sep 2006 23:50:04 GMT]]></title><description><![CDATA[<p>ConfusedGuy schrieb:</p>
<blockquote>
<p>auf keinen fall die beiden mischen. das führt zu nicht definiertem verhalten.</p>
</blockquote>
<p>Das stimmt nit ganz...</p>
<p>Wenn du mit XXX = new Typ[...] allokierst und mit delete XXX; löscht, wird lediglich der erste Speicherblock gelöscht, also XXX[0] <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> .</p>
<p>EDIT: Was nat. nicht sinnvoll ist...da ja nicht freigegebner Speicher verbleibt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1143677</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1143677</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 24 Sep 2006 23:50:04 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu delete on Mon, 25 Sep 2006 08:02:00 GMT]]></title><description><![CDATA[<p>CodeFinder schrieb:</p>
<blockquote>
<p>Wenn du mit XXX = new Typ[...] allokierst und mit delete XXX; löscht, wird lediglich der erste Speicherblock gelöscht, also XXX[0] <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> .</p>
</blockquote>
<p>Auch wenn ein Compiler solch ein Verhalten zeigt, es bleibt undefiniert.</p>
<p>5.3.5/2 schrieb:</p>
<blockquote>
<p>In the first alternative (delete object), the value of the operand of delete shall be a pointer to a non-array object or a pointer to a sub-object (1.8) representing a base class of such an object (clause 10). If not, the behavior is undefined.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1143786</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1143786</guid><dc:creator><![CDATA[groovemaster]]></dc:creator><pubDate>Mon, 25 Sep 2006 08:02:00 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu delete on Mon, 25 Sep 2006 08:06:37 GMT]]></title><description><![CDATA[<p>CodeFinder schrieb:</p>
<blockquote>
<p>Wenn du mit XXX = new Typ[...] allokierst und mit delete XXX; löscht, wird lediglich der erste Speicherblock gelöscht, also XXX[0] <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> .</p>
</blockquote>
<p>Ist imho quatsch, da dies vollständig von der Freispeicherverwaltung abhängt. Die meisten bieten (selbst wenn es u.U. möglich wäre) gar keinen Mechanismus an um ein Teil am Anfang eines am Stück allokierten Blocks freizugeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1143795</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1143795</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Mon, 25 Sep 2006 08:06:37 GMT</pubDate></item></channel></rss>