<?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[Ausnahme Behandlung]]></title><description><![CDATA[<p>Hallo,<br />
Ich habe noch mal eine Frage zu Ausnahmebehandlung im Zusammenhang mit einer Dynamischen Liste.</p>
<pre><code class="language-cpp">template&lt;class T&gt;
void Liste&lt;T&gt;::pop_back() {
    if(empty()) throw &quot;pop_back(): Liste ist leer!&quot;;
    Listenelement *temp = ende;
    ende = temp-&gt;vorgaenger;
    if (!ende)    // d.h. kein weiteres Element vorhanden
        anfang = NULL;
    else
        ende-&gt;naechstes = NULL;
    delete temp;
    --anzahl;
}
</code></pre>
<p>Hier wird ja falls die Liste schon leer ist eine Ausnahme geworfen. Aber Die Operationen mit der Liste werden trotzdem durchgeführt. Ist das sinnvoll?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/263257/ausnahme-behandlung</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 22:42:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/263257.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 17 Mar 2010 20:11:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ausnahme Behandlung on Wed, 17 Mar 2010 20:11:57 GMT]]></title><description><![CDATA[<p>Hallo,<br />
Ich habe noch mal eine Frage zu Ausnahmebehandlung im Zusammenhang mit einer Dynamischen Liste.</p>
<pre><code class="language-cpp">template&lt;class T&gt;
void Liste&lt;T&gt;::pop_back() {
    if(empty()) throw &quot;pop_back(): Liste ist leer!&quot;;
    Listenelement *temp = ende;
    ende = temp-&gt;vorgaenger;
    if (!ende)    // d.h. kein weiteres Element vorhanden
        anfang = NULL;
    else
        ende-&gt;naechstes = NULL;
    delete temp;
    --anzahl;
}
</code></pre>
<p>Hier wird ja falls die Liste schon leer ist eine Ausnahme geworfen. Aber Die Operationen mit der Liste werden trotzdem durchgeführt. Ist das sinnvoll?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1870574</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1870574</guid><dc:creator><![CDATA[Der Anfänger!]]></dc:creator><pubDate>Wed, 17 Mar 2010 20:11:57 GMT</pubDate></item><item><title><![CDATA[Reply to Ausnahme Behandlung on Wed, 17 Mar 2010 20:14:54 GMT]]></title><description><![CDATA[<p>Was wird soll da nach dem throw noch ausgeführt werden?</p>
<p>Ein throw verlässt <strong>sofort</strong> die aktuelle Stelle und springt in den catch Handler (Nach dem Rollback natürlich).</p>
<p>Bei allem, was nach dem throw kommt kannst du annehmen, dass die Liste nicht leer ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1870577</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1870577</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 17 Mar 2010 20:14:54 GMT</pubDate></item><item><title><![CDATA[Reply to Ausnahme Behandlung on Wed, 17 Mar 2010 20:20:06 GMT]]></title><description><![CDATA[<p>Ah na dann ist es natürlich richtig so. Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1870580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1870580</guid><dc:creator><![CDATA[Der Anfänger!]]></dc:creator><pubDate>Wed, 17 Mar 2010 20:20:06 GMT</pubDate></item></channel></rss>