<?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[Warum klappt dieser dynamic_cast nicht????]]></title><description><![CDATA[<p>Warum bringt der folgende Code beim Compilieren eine Warnung</p>
<p>&quot;warning C4541: 'dynamic_cast' fuer polymorphen Typ 'class MyException' mit /GR- verwendet; unvorhersehbares Verhalten moeglich&quot;</p>
<p>und bei der Ausführung von dynamic_cast() eine Exception...???...versteh ich nicht...normaleweise sollte das doch funktionieren....was mache ich falsch...</p>
<p>MyException * e = new MyException();<br />
MyException * e2 = dynamic_cast&lt;MyException *&gt; (e);</p>
<p>if (e2 == NULL){<br />
AfxMessageBox(CString(&quot;Cast nicht ok&quot;));<br />
} else {<br />
AfxMessageBox(CString(&quot;cast ok&quot;));<br />
}</p>
<p>(MyException ist in dem Fall ne leere Dummy-Klasse. Ich hab sie nur eben kurz mit VisualStudio eingefügt als generische Klasse, die von nichts abgeleitet ist...)</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/138793/warum-klappt-dieser-dynamic_cast-nicht</link><generator>RSS for Node</generator><lastBuildDate>Sun, 30 Aug 2026 06:21:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/138793.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Mar 2006 12:01:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Warum klappt dieser dynamic_cast nicht???? on Wed, 01 Mar 2006 12:01:35 GMT]]></title><description><![CDATA[<p>Warum bringt der folgende Code beim Compilieren eine Warnung</p>
<p>&quot;warning C4541: 'dynamic_cast' fuer polymorphen Typ 'class MyException' mit /GR- verwendet; unvorhersehbares Verhalten moeglich&quot;</p>
<p>und bei der Ausführung von dynamic_cast() eine Exception...???...versteh ich nicht...normaleweise sollte das doch funktionieren....was mache ich falsch...</p>
<p>MyException * e = new MyException();<br />
MyException * e2 = dynamic_cast&lt;MyException *&gt; (e);</p>
<p>if (e2 == NULL){<br />
AfxMessageBox(CString(&quot;Cast nicht ok&quot;));<br />
} else {<br />
AfxMessageBox(CString(&quot;cast ok&quot;));<br />
}</p>
<p>(MyException ist in dem Fall ne leere Dummy-Klasse. Ich hab sie nur eben kurz mit VisualStudio eingefügt als generische Klasse, die von nichts abgeleitet ist...)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005830</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005830</guid><dc:creator><![CDATA[wayneschlegel]]></dc:creator><pubDate>Wed, 01 Mar 2006 12:01:35 GMT</pubDate></item><item><title><![CDATA[Reply to Warum klappt dieser dynamic_cast nicht???? on Wed, 01 Mar 2006 12:03:23 GMT]]></title><description><![CDATA[<p>Ich kenne den Compiler nicht, aber ich würde jetzt einfach mal raten (aus der Fehlermeldung), man muss /GR+ setzen damit er RTTI Informationen erzeugt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005833</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005833</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Wed, 01 Mar 2006 12:03:23 GMT</pubDate></item><item><title><![CDATA[Reply to Warum klappt dieser dynamic_cast nicht???? on Wed, 01 Mar 2006 12:03:48 GMT]]></title><description><![CDATA[<p>Erstens ist das &quot;nur&quot; eine Warnung <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="😉"
    /> Und zweitens kann man bei Visual Studio die RTTI (Run Time Type Information) auch ausschalten - danach wird das Programm etwas kleiner, aber dynamic_cast und typeid funktionieren nicht mehr richtig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005835</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Wed, 01 Mar 2006 12:03:48 GMT</pubDate></item><item><title><![CDATA[Reply to Warum klappt dieser dynamic_cast nicht???? on Wed, 01 Mar 2006 12:22:24 GMT]]></title><description><![CDATA[<p>Nachtrag: Die entsprechende Option findest du im Visual Studio unter Projekt -&gt; Einstellungen -&gt; C/C++ -&gt; Programmiersprache C++.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005860</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005860</guid><dc:creator><![CDATA[CStoll (off)]]></dc:creator><pubDate>Wed, 01 Mar 2006 12:22:24 GMT</pubDate></item><item><title><![CDATA[Reply to Warum klappt dieser dynamic_cast nicht???? on Wed, 01 Mar 2006 13:58:53 GMT]]></title><description><![CDATA[<p>Bei der Warnung ist der ist die Laufzeit-Typinformation(RTTI) im VC nicht aktiviert. Damit kann die Richtigkeit eines dynamic_cast nicht geprüft werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005952</guid><dc:creator><![CDATA[don_basto]]></dc:creator><pubDate>Wed, 01 Mar 2006 13:58:53 GMT</pubDate></item><item><title><![CDATA[Reply to Warum klappt dieser dynamic_cast nicht???? on Wed, 01 Mar 2006 14:02:23 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">MyException * e = new MyException();
MyException * e2 = dynamic_cast&lt;MyException&gt; (e);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1005954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005954</guid><dc:creator><![CDATA[HirnAktivieren]]></dc:creator><pubDate>Wed, 01 Mar 2006 14:02:23 GMT</pubDate></item><item><title><![CDATA[Reply to Warum klappt dieser dynamic_cast nicht???? on Wed, 01 Mar 2006 14:10:13 GMT]]></title><description><![CDATA[<p>HirnAktivieren schrieb:</p>
<blockquote>
<pre><code class="language-cpp">MyException * e = new MyException();
MyException * e2 = dynamic_cast&lt;MyException&gt; (e);
</code></pre>
</blockquote>
<p>Wenn man keine Ahnung hat...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005959</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005959</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Wed, 01 Mar 2006 14:10:13 GMT</pubDate></item></channel></rss>