<?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[deque fehler abfangen?]]></title><description><![CDATA[<p>hi,<br />
wenn ich ein 'deque.push_front(x)' mache, kann es doch sein, dass kein speicher mehr da ist. muss man da 'ne exception abfangen oder wie funzt das?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/152944/deque-fehler-abfangen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 24 May 2026 17:27:16 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/152944.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 11 Jul 2006 11:29:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to deque fehler abfangen? on Tue, 11 Jul 2006 11:29:31 GMT]]></title><description><![CDATA[<p>hi,<br />
wenn ich ein 'deque.push_front(x)' mache, kann es doch sein, dass kein speicher mehr da ist. muss man da 'ne exception abfangen oder wie funzt das?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1095708</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1095708</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Tue, 11 Jul 2006 11:29:31 GMT</pubDate></item><item><title><![CDATA[Reply to deque fehler abfangen? on Tue, 11 Jul 2006 11:38:52 GMT]]></title><description><![CDATA[<p>eine problem wegen fehlendem speicher kann bei jedem container in einer funktion, die potentiell speicher anfordert, auftreten. in diesem falle wird stets eine exception vom typ std::bad_alloc (oder einer davon public abgeleiteten klasse) geworfen (geaugenommen hängt das konkrete verhalten vom verwendeten allocator ab, aber zumindest der standard-allocator verhält sich so). in der regel hat es allerdings keinen sinn, einen derartigen fehler lokal zu behandeln. es darf allerdings grundsätzlich keine exception die main-funktion verlassen - ein allgemeiner handler mit ellipse kann dort also angebracht sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1095714</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1095714</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Tue, 11 Jul 2006 11:38:52 GMT</pubDate></item><item><title><![CDATA[Reply to deque fehler abfangen? on Tue, 11 Jul 2006 11:52:17 GMT]]></title><description><![CDATA[<p>ok, danke, hatte mir schon sowas ähnliches gedacht <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="😉"
    /><br />
ich hatte es bis jetzt so, werd's wohl so lassen:</p>
<pre><code>int MTQueue::Write (unsigned char b)
{
    volatile int result;

    EnterCriticalSection (&amp;m_crit);
    try
    {
        m_queue.push_front(b);    
        result = 1;    // OK
    }
    catch (...)
    {
        result = -1;   // FUCK
    }
    LeaveCriticalSection (&amp;m_crit);

    return result;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1095723</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1095723</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Tue, 11 Jul 2006 11:52:17 GMT</pubDate></item><item><title><![CDATA[Reply to deque fehler abfangen? on Tue, 11 Jul 2006 11:59:15 GMT]]></title><description><![CDATA[<p>net schrieb:</p>
<blockquote>
<p>ok, danke, hatte mir schon sowas ähnliches gedacht <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="😉"
    /><br />
ich hatte es bis jetzt so, werd's wohl so lassen:</p>
<pre><code>int MTQueue::Write (unsigned char b)
{
    volatile int result;

    EnterCriticalSection (&amp;m_crit);
    try
    {
        m_queue.push_front(b);    
        result = 1;    // OK
    }
    catch (...)
    {
        result = -1;   // FUCK
    }
    LeaveCriticalSection (&amp;m_crit);

    return result;
}
</code></pre>
</blockquote>
<p>hm, wieso nicht einfach in der main, so wie's camper geschrieben hat? Jetzt arbeitest du ja doch lokal auf dem Problem...</p>
<p>MfG</p>
<p>GPC</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1095731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1095731</guid><dc:creator><![CDATA[GPC]]></dc:creator><pubDate>Tue, 11 Jul 2006 11:59:15 GMT</pubDate></item><item><title><![CDATA[Reply to deque fehler abfangen? on Tue, 11 Jul 2006 12:10:42 GMT]]></title><description><![CDATA[<p>GPC schrieb:</p>
<blockquote>
<p>hm, wieso nicht einfach in der main, so wie's camper geschrieben hat? Jetzt arbeitest du ja doch lokal auf dem Problem...</p>
</blockquote>
<p>am anderen ende der queue saugt ein thread die daten raus. wenn wieder platz ist, möchte ich den schreibvorgang wiederholen. ist eh' nur ein sicherheitscheck. es wird wohl nie vorkommen, das die queue so voll wird...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1095740</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1095740</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Tue, 11 Jul 2006 12:10:42 GMT</pubDate></item></channel></rss>