<?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[Fehlermeldung bei der Übergabe des Return Wertes]]></title><description><![CDATA[<p>Hola</p>
<p>ich habe da ein Problem und Steige nicht dahinter. Folgende Fehlermeldung bekomme ich.</p>
<blockquote>
<p>warning C4244: 'return': Konvertierung von 'double' in 'int', möglicher Datenverlust</p>
</blockquote>
<p>Bei folgendem Code:</p>
<pre><code class="language-cpp">Int32 division(Int32 Zahl1, Int32 Zahl2)
{
	Double Ergebnis;

	Ergebnis = safe_cast&lt;Double&gt;(Zahl1 / Zahl2);

	return Ergebnis;
}
</code></pre>
<p>Dort wird die Funktion aufgerufen:</p>
<pre><code class="language-cpp">else if(Operant == '/')
	{
		Console::WriteLine(&quot;Das Ergebnis aus {0} / {1} lautet: {2}&quot;, Zahl1, Zahl2, division(Zahl1, Zahl2));
	}
</code></pre>
<p>Ich danke schoneinmal für eure Hilfe.</p>
<p>LG</p>
<p>Sk8te</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/260417/fehlermeldung-bei-der-übergabe-des-return-wertes</link><generator>RSS for Node</generator><lastBuildDate>Tue, 08 Sep 2026 03:26:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/260417.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Feb 2010 22:11:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fehlermeldung bei der Übergabe des Return Wertes on Thu, 04 Feb 2010 22:11:04 GMT]]></title><description><![CDATA[<p>Hola</p>
<p>ich habe da ein Problem und Steige nicht dahinter. Folgende Fehlermeldung bekomme ich.</p>
<blockquote>
<p>warning C4244: 'return': Konvertierung von 'double' in 'int', möglicher Datenverlust</p>
</blockquote>
<p>Bei folgendem Code:</p>
<pre><code class="language-cpp">Int32 division(Int32 Zahl1, Int32 Zahl2)
{
	Double Ergebnis;

	Ergebnis = safe_cast&lt;Double&gt;(Zahl1 / Zahl2);

	return Ergebnis;
}
</code></pre>
<p>Dort wird die Funktion aufgerufen:</p>
<pre><code class="language-cpp">else if(Operant == '/')
	{
		Console::WriteLine(&quot;Das Ergebnis aus {0} / {1} lautet: {2}&quot;, Zahl1, Zahl2, division(Zahl1, Zahl2));
	}
</code></pre>
<p>Ich danke schoneinmal für eure Hilfe.</p>
<p>LG</p>
<p>Sk8te</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1850682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1850682</guid><dc:creator><![CDATA[Sk8te]]></dc:creator><pubDate>Thu, 04 Feb 2010 22:11:04 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlermeldung bei der Übergabe des Return Wertes on Thu, 04 Feb 2010 22:16:41 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#define Double double
#define Int32 int
#define safe_cast static_cast
</code></pre>
<p>Willst Du Double?</p>
<pre><code class="language-cpp">Double division(Int32 Zahl1, Int32 Zahl2)
{
	Double Ergebnis;

	Ergebnis = safe_cast&lt;Double&gt;(Zahl1) / safe_cast&lt;Double&gt;(Zahl2);

	return Ergebnis;
}
</code></pre>
<p>Oder willst Du Int?</p>
<pre><code class="language-cpp">Int32 division(Int32 Zahl1, Int32 Zahl2)
{
	Int32 Ergebnis;

	Ergebnis = Zahl1 / Zahl2;

	return Ergebnis;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1850683</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1850683</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Thu, 04 Feb 2010 22:16:41 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlermeldung bei der Übergabe des Return Wertes on Thu, 04 Feb 2010 22:27:47 GMT]]></title><description><![CDATA[<p>Ich wollte ein Double, da ich ein relativ korrektes Ergebnis haben wollte.</p>
<p>Ah, ich habe den Fehler entdeckt. Vielen Dank. Ich muss in der Funktion auch Double angeben.</p>
<p>Aber eins verstehe ich noch nicht.</p>
<p>Warum funktioniert das hier nicht? Ich habs, meiner Meinung nach, so in meinem Buch gelesen.</p>
<pre><code class="language-cpp">Ergebnis = safe_cast&lt;Double&gt;(Zahl1 / Zahl2);
</code></pre>
<p>Er müsste doch theoretisch die Integer Werte in der Klammer zu einem Double umwandel! Oder liege ich da ganz falsch?</p>
<p>Danke</p>
<p>lg</p>
<p>Sk8te</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1850689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1850689</guid><dc:creator><![CDATA[Sk8te]]></dc:creator><pubDate>Thu, 04 Feb 2010 22:27:47 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlermeldung bei der Übergabe des Return Wertes on Thu, 04 Feb 2010 22:32:29 GMT]]></title><description><![CDATA[<p>Das bringt nichts, weil da bei zahl1/zahl2 zwei Integers beteiligt sind, also ist das Ergebnis auch Integer. Also 20/3=6 und safe_cast&lt;double&gt;(20/3) ist auch nur safe_cast&lt;double&gt;(6).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1850694</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1850694</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Thu, 04 Feb 2010 22:32:29 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlermeldung bei der Übergabe des Return Wertes on Thu, 04 Feb 2010 22:36:51 GMT]]></title><description><![CDATA[<p>Ah! Okay, Vielen Lieben Dank für die Schnelle und Sehr Kompetente Hilfe.</p>
<p>Jetzt bin ich wieder ein Stückchen Schlauer.</p>
<p>Lg</p>
<p>Sk8te</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1850695</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1850695</guid><dc:creator><![CDATA[Sk8te]]></dc:creator><pubDate>Thu, 04 Feb 2010 22:36:51 GMT</pubDate></item></channel></rss>