<?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[CodeGuard: method called on illegelly casted obejcts]]></title><description><![CDATA[<p>Bei der Untersuchung meines Programms mit CodeGuard erhalte ich haufenweise die Meldung: &quot;method called on illegelly casted obejcts&quot;. Stehen bleibt das Programm an einer simplen Zuweisung:</p>
<p>int Rc = SRCP_WRONGVALUE;</p>
<p>in der Include-Datei steht folgendes: #define SRCP_WRONGVALUE 412</p>
<p>Ich habe das Gefühl, es liegt an der Zuweisung der #define-Werte an die Integer-Variable. Gibt es da eine Abhilfe?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/94002/codeguard-method-called-on-illegelly-casted-obejcts</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Jul 2026 16:04:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/94002.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 05 Dec 2004 08:55:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Sun, 05 Dec 2004 08:55:09 GMT]]></title><description><![CDATA[<p>Bei der Untersuchung meines Programms mit CodeGuard erhalte ich haufenweise die Meldung: &quot;method called on illegelly casted obejcts&quot;. Stehen bleibt das Programm an einer simplen Zuweisung:</p>
<p>int Rc = SRCP_WRONGVALUE;</p>
<p>in der Include-Datei steht folgendes: #define SRCP_WRONGVALUE 412</p>
<p>Ich habe das Gefühl, es liegt an der Zuweisung der #define-Werte an die Integer-Variable. Gibt es da eine Abhilfe?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/666100</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/666100</guid><dc:creator><![CDATA[Mgr]]></dc:creator><pubDate>Sun, 05 Dec 2004 08:55:09 GMT</pubDate></item><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Sun, 05 Dec 2004 10:17:14 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int Rc = static_cast&lt;int&gt;(SRCP_WRONGVALUE);
//oder 
int Rc = (int)SRCP_WRONGVALUE;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/666121</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/666121</guid><dc:creator><![CDATA[esskar]]></dc:creator><pubDate>Sun, 05 Dec 2004 10:17:14 GMT</pubDate></item><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Sun, 05 Dec 2004 11:36:05 GMT]]></title><description><![CDATA[<p>Vielen Dank für den Tipp: Leider haben beide Arten des Castens also (int) oder static_cast&lt;int&gt; nichts an den Meldungen im CodeGuard geändert.</p>
<p>Hm, was jetzt??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/666188</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/666188</guid><dc:creator><![CDATA[Mgr]]></dc:creator><pubDate>Sun, 05 Dec 2004 11:36:05 GMT</pubDate></item><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Sun, 05 Dec 2004 12:28:26 GMT]]></title><description><![CDATA[<p>hmm<br />
ich kenn den compiler nicht<br />
kann da auch nur raten.</p>
<pre><code class="language-cpp">#define SRCP_WRONGVALUE int(412)
</code></pre>
<p>ist es auch wirklich die zeile; ich hätt ja auf sowas getippt</p>
<pre><code class="language-cpp">struct A
{
};

struct B : public A 
{
   void Func();
};

A *a = new A;
((B *)a)-&gt;Func();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/666230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/666230</guid><dc:creator><![CDATA[esskar]]></dc:creator><pubDate>Sun, 05 Dec 2004 12:28:26 GMT</pubDate></item><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Sun, 05 Dec 2004 16:20:46 GMT]]></title><description><![CDATA[<p>Sorry, ich verwende CBuilder6.<br />
Also, diese Möglichkeit funktioniert ebenso nicht.<br />
Ich weiß natürlich nicht, ob dies wirklich die problematische Zeile ist, aber CodeGuard hält auf ihr an.<br />
Ich habe gerade ein Testprogramm geschrieben bei dem mit #define definierte Werte Integervariablen übergeben werden und da gibt es bei CodeGuard keine Fehlermeldung. Es scheint also mit den #define-Wertent gar nicht zu tun zu haben.</p>
<p>Vererbung eigener Klassen habe ich bei meinem Programm nicht verwendet.</p>
<p>Trotzdem weiß ich jetzt immer noch nicht wie ich das Problem einkereisen soll.<br />
Habt ihr weitere Ideen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/666412</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/666412</guid><dc:creator><![CDATA[Mgr]]></dc:creator><pubDate>Sun, 05 Dec 2004 16:20:46 GMT</pubDate></item><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Sun, 05 Dec 2004 17:10:34 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>wenn du es ändern kannst : warum nimmst du statt <em>define</em> nicht <em>const int</em>?</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/666459</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/666459</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 05 Dec 2004 17:10:34 GMT</pubDate></item><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Sun, 05 Dec 2004 17:36:19 GMT]]></title><description><![CDATA[<p>Also ich glaube inzwischen, dass mein Problem gar nichts mit den #defines zu tun hat, denn die Meldungen erschinen auch wenn ich folgendes schreibe:</p>
<p>int Rc = 412;</p>
<p>Warum bleibt CodeGuard aber immer auf dieser Zeile stehen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/666481</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/666481</guid><dc:creator><![CDATA[Mgr]]></dc:creator><pubDate>Sun, 05 Dec 2004 17:36:19 GMT</pubDate></item><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Sun, 05 Dec 2004 17:38:22 GMT]]></title><description><![CDATA[<p>zeig mal den codeblock oberhalb bzw. unterhalb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/666483</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/666483</guid><dc:creator><![CDATA[esskar]]></dc:creator><pubDate>Sun, 05 Dec 2004 17:38:22 GMT</pubDate></item><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Sun, 05 Dec 2004 18:04:44 GMT]]></title><description><![CDATA[<p>Also hier ist die Funktion, bei der CodeGuard stehen bleibt:</p>
<pre><code>//---------------------------------------------------------------------------
int  CBus::describeBus(int Busnr, char *Reply) {
   char tmpbuf[40];
   int Rc = SRCP_WRONGVALUE;

   if (Busnr&lt;0 || Busnr&gt;=MAX_BUSSES) {
      return Rc;
   }

   switch (Busnr) {
         case  0: strcpy(tmpbuf,&quot;SERVER SESSION TIME&quot;); break;
	 case  1: strcpy(tmpbuf,&quot;GL POWER&quot;); break;
	 case  2: strcpy(tmpbuf, &quot;GL POWER&quot;); break;
  	 case  3: strcpy(tmpbuf, &quot;GL POWER&quot;); break;
         case  4: strcpy(tmpbuf,&quot;GL POWER&quot;); break;
	 case  5: strcpy(tmpbuf,&quot;GA POWER&quot;); break;
         case  6: strcpy(tmpbuf,&quot;GA POWER&quot;); break;
	 case  7: strcpy(tmpbuf,&quot;GA POWER&quot;); break;
	 case  8: strcpy(tmpbuf,&quot;FB POWER&quot;); break;
	 case  9: strcpy(tmpbuf,&quot;FB POWER&quot;); break;
	 case 10: strcpy(tmpbuf,&quot;FB POWER&quot;); break;
         case 11: strcpy(tmpbuf,&quot;SM&quot;);break;
      }

      sprintf(Reply,&quot;INFO %d DESCRIPTION %s&quot;,Busnr, tmpbuf);
      return SRCP_INFO;

}
//---------------------------------------------------------------------------
</code></pre>
<p>Reicht das? Wenn nicht was braucht ihr noch zur Beurteilung? Die gesamte Unit hat 800 Codezeilen, es scheint mir also nicht sinnvoll die gesamte Unit hier aufzuführen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/666508</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/666508</guid><dc:creator><![CDATA[Mgr]]></dc:creator><pubDate>Sun, 05 Dec 2004 18:04:44 GMT</pubDate></item><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Sun, 05 Dec 2004 22:13:55 GMT]]></title><description><![CDATA[<p>Sieh dich doch mal in den <a href="http://groups.google.com/groups?hl=en&amp;lr=&amp;q=method+called+on+illegally+casted&amp;btnG=Search&amp;meta=" rel="nofollow">Borland Newsgroups</a> um, da gibt es etliche Threads zum Thema.<br />
Das nur als Tip, ich habe keine Ahnung, ob sich dort auch eine Lösung für deinen Fall findet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/666746</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/666746</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Sun, 05 Dec 2004 22:13:55 GMT</pubDate></item><item><title><![CDATA[Reply to CodeGuard: method called on illegelly casted obejcts on Tue, 07 Dec 2004 14:46:28 GMT]]></title><description><![CDATA[<p>was passiert, wenn du folgendes draus machst?</p>
<pre><code class="language-cpp">if (Busnr&lt;0 || Busnr&gt;=MAX_BUSSES) 
{ 
  return SRCP_WRONGVALUE; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/668082</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668082</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Tue, 07 Dec 2004 14:46:28 GMT</pubDate></item></channel></rss>