<?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[try-catch Problem]]></title><description><![CDATA[<p>Hi,</p>
<p>Wieso will das hier nicht funktionieren:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;
...
vector&lt;float&gt; fvect1;
...
try
{
  fvect1.resize(99999999999999999999999, 0);
}
catch(const bad_alloc&amp; e_ba) 
{
  cerr &lt;&lt; &quot;Nicht genugend Speicher vorhanden!&quot; &lt;&lt; endl;
  return(1);
}
</code></pre>
<p>--&gt; Der catch-Block wird nicht ausgeführt. Stattdessen wird mein Programm einfach terminiert.</p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/288243/try-catch-problem</link><generator>RSS for Node</generator><lastBuildDate>Thu, 20 Aug 2026 01:27:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/288243.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 13 Jun 2011 08:46:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to try-catch Problem on Mon, 13 Jun 2011 08:47:09 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Wieso will das hier nicht funktionieren:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;
...
vector&lt;float&gt; fvect1;
...
try
{
  fvect1.resize(99999999999999999999999, 0);
}
catch(const bad_alloc&amp; e_ba) 
{
  cerr &lt;&lt; &quot;Nicht genugend Speicher vorhanden!&quot; &lt;&lt; endl;
  return(1);
}
</code></pre>
<p>--&gt; Der catch-Block wird nicht ausgeführt. Stattdessen wird mein Programm einfach terminiert.</p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2077359</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2077359</guid><dc:creator><![CDATA[Jeffson]]></dc:creator><pubDate>Mon, 13 Jun 2011 08:47:09 GMT</pubDate></item><item><title><![CDATA[Reply to try-catch Problem on Mon, 13 Jun 2011 08:52:03 GMT]]></title><description><![CDATA[<p>offensichtlich macht &quot;resize&quot; kein &quot;if (blabla &gt; max) throw ...;&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2077361</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2077361</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 13 Jun 2011 08:52:03 GMT</pubDate></item><item><title><![CDATA[Reply to try-catch Problem on Mon, 13 Jun 2011 08:58:28 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;vector&gt;
#include &lt;iostream&gt;
#include &lt;stdexcept&gt;
using namespace std;

int main()
{
    vector&lt;float&gt; fvect1;

    int x=99999999999999999999999;
    cout&lt;&lt;x&lt;&lt;endl;

    try
    {
        fvect1.resize(99999999999999999999999, 0);
    }
    catch(const bad_alloc&amp; e_ba)
    {
        cerr &lt;&lt; &quot;Nicht genugend Speicher vorhanden!&quot; &lt;&lt; endl;
        return(1);
    }
    catch(const length_error&amp; e_ba)
    {
        cerr &lt;&lt; &quot;Paßt gar nicht mehr in den Adressraum oder sowas.&quot; &lt;&lt; endl;
        return(1);
    }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2077362</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2077362</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Mon, 13 Jun 2011 08:58:28 GMT</pubDate></item><item><title><![CDATA[Reply to try-catch Problem on Mon, 13 Jun 2011 13:54:36 GMT]]></title><description><![CDATA[<p>Es sollte auf einem normalen System auch einen Überfluss geben, da &quot;99999999999999999999999&quot; normalerweise weder in einen <code>int</code> noch in einen <code>std::size_t</code> passt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2077469</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2077469</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Mon, 13 Jun 2011 13:54:36 GMT</pubDate></item></channel></rss>