<?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[Cast auf kleineren Typen. Wieso kein Warnung?]]></title><description><![CDATA[<p>Morgen,</p>
<p>folgender Code:</p>
<pre><code class="language-cpp">int foo = 22;
short bar = foo;
</code></pre>
<p>wenn ich den mit gcc -Wall kompiliere, kriege ich KEIN Warning! bar ist doch kleiner als int, sollte das nicht ein Warning ergeben?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/287247/cast-auf-kleineren-typen-wieso-kein-warnung</link><generator>RSS for Node</generator><lastBuildDate>Thu, 20 Aug 2026 13:57:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/287247.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 25 May 2011 09:03:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Cast auf kleineren Typen. Wieso kein Warnung? on Wed, 25 May 2011 09:03:07 GMT]]></title><description><![CDATA[<p>Morgen,</p>
<p>folgender Code:</p>
<pre><code class="language-cpp">int foo = 22;
short bar = foo;
</code></pre>
<p>wenn ich den mit gcc -Wall kompiliere, kriege ich KEIN Warning! bar ist doch kleiner als int, sollte das nicht ein Warning ergeben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2068300</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2068300</guid><dc:creator><![CDATA[Warnwilliger]]></dc:creator><pubDate>Wed, 25 May 2011 09:03:07 GMT</pubDate></item><item><title><![CDATA[Reply to Cast auf kleineren Typen. Wieso kein Warnung? on Wed, 25 May 2011 09:08:35 GMT]]></title><description><![CDATA[<p>Weil es ein Literal ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2068302</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2068302</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Wed, 25 May 2011 09:08:35 GMT</pubDate></item><item><title><![CDATA[Reply to Cast auf kleineren Typen. Wieso kein Warnung? on Wed, 25 May 2011 09:33:17 GMT]]></title><description><![CDATA[<p>Wieso literal? foo ist doch eine Variable</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2068313</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2068313</guid><dc:creator><![CDATA[Warnwilliger]]></dc:creator><pubDate>Wed, 25 May 2011 09:33:17 GMT</pubDate></item><item><title><![CDATA[Reply to Cast auf kleineren Typen. Wieso kein Warnung? on Wed, 25 May 2011 10:27:23 GMT]]></title><description><![CDATA[<p>Ja, aber ich ging davon aus, dass der Compiler &quot;merkt&quot;, dass bar letzendlich über ein Literal initialisiert wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2068351</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2068351</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Wed, 25 May 2011 10:27:23 GMT</pubDate></item><item><title><![CDATA[Reply to Cast auf kleineren Typen. Wieso kein Warnung? on Wed, 25 May 2011 10:54:53 GMT]]></title><description><![CDATA[<p>Ich kann's auch nicht erklären, würde dir nur von dieser Art von Typumwandlung abraten, da sobald foo den Wertebereich von bar (+-32767) verlässt, bekommst du komplett andere Werte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2068367</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2068367</guid><dc:creator><![CDATA[*Rewind*]]></dc:creator><pubDate>Wed, 25 May 2011 10:54:53 GMT</pubDate></item><item><title><![CDATA[Reply to Cast auf kleineren Typen. Wieso kein Warnung? on Wed, 25 May 2011 10:58:55 GMT]]></title><description><![CDATA[<p>[Rewind] schrieb:</p>
<blockquote>
<p>den Wertebereich von bar (+-32767) verlässt</p>
</blockquote>
<p>Wer sagt, wie gross genau der Wertebereich von <code>short</code> ist? Der Standard nicht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2068368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2068368</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Wed, 25 May 2011 10:58:55 GMT</pubDate></item><item><title><![CDATA[Reply to Cast auf kleineren Typen. Wieso kein Warnung? on Wed, 25 May 2011 11:27:54 GMT]]></title><description><![CDATA[<p>Warnwilliger schrieb:</p>
<blockquote>
<p>Morgen,</p>
<p>folgender Code:</p>
<pre><code class="language-cpp">int foo = 22;
short bar = foo;
</code></pre>
<p>wenn ich den mit gcc -Wall kompiliere, kriege ich KEIN Warning! bar ist doch kleiner als int, sollte das nicht ein Warning ergeben?</p>
</blockquote>
<p>Warnt er bei</p>
<pre><code class="language-cpp">int foo = rand();
short bar = foo;
</code></pre>
<p>?<br />
Falls ja, liegt es wirklich nur daran, daß der Compiler ein Schlauberger ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2068380</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2068380</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Wed, 25 May 2011 11:27:54 GMT</pubDate></item></channel></rss>