<?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 scheint exception nicht abzufangen]]></title><description><![CDATA[<p>Moin.</p>
<p>Ich versuche zum ersten mal unter C++ Exceptionhandling zu betreiben, was aber nicht zu funktionieren scheint.</p>
<p>Für Testzwecke habe ich für Windows CE ein einfaches MFC Projekt erstellt und folgendes versucht:</p>
<pre><code class="language-cpp">CChildView::CChildView()
{
		try
		{
			RETAILMSG(true,(_T(&quot;try 01\n&quot;)));
			int *b = 0;
			*b = 55;
			RETAILMSG(true,(_T(&quot;try 02\n&quot;)));
		}
		catch (...)
		{
			RETAILMSG(true,(_T(&quot;exception\n&quot;)));
		}

		RETAILMSG(true,(_T(&quot;nach try catch\n&quot;)));
}
</code></pre>
<p>Es wird also eine exception im try Block ausgelöst. Die Ausgabe sagt aber:</p>
<blockquote>
<p>try 01<br />
Unhandled exception at 0x00011a4c in TryCatch.exe: 0xC0000005: Access violation.<br />
Das Programm &quot;[0x58300B6] TryCatch.exe&quot; wurde mit Code -1073741819 (0xc0000005) beendet.</p>
</blockquote>
<p>Wieso wird das nicht abgefangen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/286629/try-catch-scheint-exception-nicht-abzufangen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 20 Aug 2026 21:31:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/286629.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 13 May 2011 12:40:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to try-catch scheint exception nicht abzufangen on Fri, 13 May 2011 12:40:45 GMT]]></title><description><![CDATA[<p>Moin.</p>
<p>Ich versuche zum ersten mal unter C++ Exceptionhandling zu betreiben, was aber nicht zu funktionieren scheint.</p>
<p>Für Testzwecke habe ich für Windows CE ein einfaches MFC Projekt erstellt und folgendes versucht:</p>
<pre><code class="language-cpp">CChildView::CChildView()
{
		try
		{
			RETAILMSG(true,(_T(&quot;try 01\n&quot;)));
			int *b = 0;
			*b = 55;
			RETAILMSG(true,(_T(&quot;try 02\n&quot;)));
		}
		catch (...)
		{
			RETAILMSG(true,(_T(&quot;exception\n&quot;)));
		}

		RETAILMSG(true,(_T(&quot;nach try catch\n&quot;)));
}
</code></pre>
<p>Es wird also eine exception im try Block ausgelöst. Die Ausgabe sagt aber:</p>
<blockquote>
<p>try 01<br />
Unhandled exception at 0x00011a4c in TryCatch.exe: 0xC0000005: Access violation.<br />
Das Programm &quot;[0x58300B6] TryCatch.exe&quot; wurde mit Code -1073741819 (0xc0000005) beendet.</p>
</blockquote>
<p>Wieso wird das nicht abgefangen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2062756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2062756</guid><dc:creator><![CDATA[ViktorII]]></dc:creator><pubDate>Fri, 13 May 2011 12:40:45 GMT</pubDate></item><item><title><![CDATA[Reply to try-catch scheint exception nicht abzufangen on Fri, 13 May 2011 12:52:02 GMT]]></title><description><![CDATA[<p>Weil per Default nur C++ Exceptions und keine structured Exceptions gefangen werden.</p>
<p>Versuch dazu die extra Statement __try und __catch und Windows. Unter Linux solltest du einen Signal-Handler setzen.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/s58ftw19%28v=vs.80%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/s58ftw19(v=vs.80).aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2062758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2062758</guid><dc:creator><![CDATA[Ethon]]></dc:creator><pubDate>Fri, 13 May 2011 12:52:02 GMT</pubDate></item><item><title><![CDATA[Reply to try-catch scheint exception nicht abzufangen on Fri, 13 May 2011 12:56:08 GMT]]></title><description><![CDATA[<blockquote>
<p>Unter Linux solltest du einen Signal-Handler setzen.</p>
</blockquote>
<p>Unter Windows auch: <a href="http://msdn.microsoft.com/en-us/library/ms680634.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms680634.aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2062761</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2062761</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Fri, 13 May 2011 12:56:08 GMT</pubDate></item><item><title><![CDATA[Reply to try-catch scheint exception nicht abzufangen on Fri, 13 May 2011 13:49:35 GMT]]></title><description><![CDATA[<p>Sowas solltest du mit dem Debugger schnell finden und beheben. Access violations sind schwere Programmierfehler.<br />
Davon abgesehen sollte man nur die Exceptoins fangen, die man auch beheben kann. Ein catchallist nur an Modulgrenzen sinnvoll, wenn überhaupt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2062776</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2062776</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Fri, 13 May 2011 13:49:35 GMT</pubDate></item><item><title><![CDATA[Reply to try-catch scheint exception nicht abzufangen on Fri, 13 May 2011 13:51:40 GMT]]></title><description><![CDATA[<p>pumuckl schrieb:</p>
<blockquote>
<p>Sowas solltest du mit dem Debugger schnell finden und beheben. Access violations sind schwere Programmierfehler.<br />
Davon abgesehen sollte man nur die Exceptoins fangen, die man auch beheben kann. Ein catchallist nur an Modulgrenzen sinnvoll, wenn überhaupt.</p>
</blockquote>
<p>Da bin ich gleicher Meinung - besonders sinnvoll ist, denke ich (in grösseren Projekten), einen Dump zu schreiben (z.B. MiniDump unter Windows).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2062777</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2062777</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Fri, 13 May 2011 13:51:40 GMT</pubDate></item></channel></rss>