<?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[Herausfinden welche Exceptions alle geworfen werden können]]></title><description><![CDATA[<p>Hi,</p>
<p>ich bin noch recht neu in Cpp und möchte von daher in meinen Programmen möglichst viele Fehlerabfragen einbauen. Nun ist meine Frage, woher weiß ich welche Exceptions ich zum Beispiel bei string operationen abfangen muss.</p>
<p>Bsp:</p>
<pre><code class="language-cpp">try
{
    std::string test( &quot;blabla&quot; );
    // haufenweise Methoden von test
}
catch( /* welche Exceptions sind alles möglich */ )
{

}
</code></pre>
<p>Das gleiche gilt für Datei Zugriffe via std::fstream.<br />
Ich habe gesucht, aber leider keine Liste gefunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/207187/herausfinden-welche-exceptions-alle-geworfen-werden-können</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 00:41:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/207187.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 04 Mar 2008 16:52:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Herausfinden welche Exceptions alle geworfen werden können on Tue, 04 Mar 2008 16:52:27 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich bin noch recht neu in Cpp und möchte von daher in meinen Programmen möglichst viele Fehlerabfragen einbauen. Nun ist meine Frage, woher weiß ich welche Exceptions ich zum Beispiel bei string operationen abfangen muss.</p>
<p>Bsp:</p>
<pre><code class="language-cpp">try
{
    std::string test( &quot;blabla&quot; );
    // haufenweise Methoden von test
}
catch( /* welche Exceptions sind alles möglich */ )
{

}
</code></pre>
<p>Das gleiche gilt für Datei Zugriffe via std::fstream.<br />
Ich habe gesucht, aber leider keine Liste gefunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1468209</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1468209</guid><dc:creator><![CDATA[Neulinggg]]></dc:creator><pubDate>Tue, 04 Mar 2008 16:52:27 GMT</pubDate></item><item><title><![CDATA[Reply to Herausfinden welche Exceptions alle geworfen werden können on Tue, 04 Mar 2008 16:56:31 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Da eigentlich nur Ableitungen von std::exception geworfen werden sollen (und die Standard-Library das auch so macht) genügt das</p>
<pre><code class="language-cpp">try
{
    std::string test( &quot;blabla&quot; );
    // haufenweise Methoden von test
}
catch( std::exception&amp; ex )
{
  std::cout &lt;&lt; ex.what() &lt;&lt; std::endl;
}
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1468212</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1468212</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 04 Mar 2008 16:56:31 GMT</pubDate></item><item><title><![CDATA[Reply to Herausfinden welche Exceptions alle geworfen werden können on Tue, 04 Mar 2008 17:01:24 GMT]]></title><description><![CDATA[<p>Aber, ich möchte ind der Regel ja nicht nur wissen was passiert ist, sondern auch sofort reagieren können. Einen Index_Overflow behandele ich ja anders als ein Memory Fehler.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1468214</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1468214</guid><dc:creator><![CDATA[Neulinggg]]></dc:creator><pubDate>Tue, 04 Mar 2008 17:01:24 GMT</pubDate></item><item><title><![CDATA[Reply to Herausfinden welche Exceptions alle geworfen werden können on Tue, 04 Mar 2008 17:29:43 GMT]]></title><description><![CDATA[<p>Und? Wo ist das Problem?</p>
<pre><code class="language-cpp">try
{
    std::string test( &quot;blabla&quot; );
    // haufenweise Methoden von test
}
catch( std::out_of_range&amp; ex )
{
  std::cout &lt;&lt; ex.what() &lt;&lt; std::endl;
}
catch( std::bad_alloc&amp; ex )
{
  std::cout &lt;&lt; ex.what() &lt;&lt; std::endl;
}
catch( std::exception&amp; ex )
{
  std::cout &lt;&lt; ex.what() &lt;&lt; std::endl;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1468233</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1468233</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Tue, 04 Mar 2008 17:29:43 GMT</pubDate></item><item><title><![CDATA[Reply to Herausfinden welche Exceptions alle geworfen werden können on Tue, 04 Mar 2008 18:28:40 GMT]]></title><description><![CDATA[<p>Artchi schrieb:</p>
<blockquote>
<p>Und? Wo ist das Problem?<br />
...</p>
</blockquote>
<p>Ich denke mal, sein &quot;Problem&quot; besteht darin, dass er nicht um jedes Statement einen try/catch-Block für alle exceptions aus &lt;stdexcep&gt; basteln will.</p>
<p>Ich bin mir nicht sicher, ob der Standard sich dazu äußert, welche Funktionen welche exceptions werfen und welche nicht.</p>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1468285</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1468285</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Tue, 04 Mar 2008 18:28:40 GMT</pubDate></item><item><title><![CDATA[Reply to Herausfinden welche Exceptions alle geworfen werden können on Tue, 04 Mar 2008 19:06:13 GMT]]></title><description><![CDATA[<p>Bei vielen Funktionen steht die möglich Exception im Standard. Manchmal, wie im Fall basic_string steht einfach nur da welche exceptions von Funktionen dieser Klasse im Allgemeinen geworfen werden können.<br />
Bsp. aus 21.3 4</p>
<blockquote>
<p>The functions described in this clause can report two kinds of errors, each associated with a distinct exception:<br />
— a length error is associated with exceptions of type length_error (19.1.4);<br />
— an out-of-range error is associated with exceptions of type out_of_range (19.1.5).</p>
</blockquote>
<p>Man muss sich da dann halt durchwühlen. <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/1468321</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1468321</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 04 Mar 2008 19:06:13 GMT</pubDate></item><item><title><![CDATA[Reply to Herausfinden welche Exceptions alle geworfen werden können on Tue, 04 Mar 2008 19:22:53 GMT]]></title><description><![CDATA[<p>In C++ Exceptions nicht so verwenden wie in Java. Es gibt keine checked Exc. und das macht alles zunichte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1468333</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1468333</guid><dc:creator><![CDATA[wichtig]]></dc:creator><pubDate>Tue, 04 Mar 2008 19:22:53 GMT</pubDate></item><item><title><![CDATA[Reply to Herausfinden welche Exceptions alle geworfen werden können on Tue, 04 Mar 2008 19:25:27 GMT]]></title><description><![CDATA[<p>ich denke auch, dass sein Problem eher ist, dass er nicht weiß, welche Exceptions geworfen werden können von bestimmen klassen und deren methoden.</p>
<p>für die zukunft: das steht gewöhnlich, wie fast alles, in der Dokumentation bzw. wie Braunstein bereits erwähnt hat, im Standard.</p>
<p>Eine Anlaufstelle für dich sollte<br />
<a href="http://dinkumware.com/manuals/default.aspx" rel="nofollow">http://dinkumware.com/manuals/default.aspx</a><br />
sein.</p>
<p>bsp.: std::vector v mit 3 werten.<br />
was wirft <a href="http://v.at" rel="nofollow">v.at</a>(size_t), wenn der übergebene index zu groß ist?<br />
=&gt; <a href="http://dinkumware.com/manuals/default.aspx?manual=compleat&amp;page=vector.html#vector::at" rel="nofollow">http://dinkumware.com/manuals/default.aspx?manual=compleat&amp;page=vector.html#vector::at</a></p>
<p>und dann siehst du bereits: &quot;the functions throws an object of class out_of_range&quot; <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>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1468336</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1468336</guid><dc:creator><![CDATA[Xantus]]></dc:creator><pubDate>Tue, 04 Mar 2008 19:25:27 GMT</pubDate></item></channel></rss>