<?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[unsigned mit negativer zahl]]></title><description><![CDATA[<p>hi, beschäftige mich gerade mit overflow / underflow bei Variablen.<br />
folgende Codezeile:</p>
<p>unsigned int i = -1;</p>
<p>ist ok.</p>
<p>möchte ich aber als Fehler / Warnung vom Compiler.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/309329/unsigned-mit-negativer-zahl</link><generator>RSS for Node</generator><lastBuildDate>Wed, 05 Aug 2026 16:36:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/309329.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Oct 2012 19:57:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to unsigned mit negativer zahl on Fri, 19 Oct 2012 19:57:25 GMT]]></title><description><![CDATA[<p>hi, beschäftige mich gerade mit overflow / underflow bei Variablen.<br />
folgende Codezeile:</p>
<p>unsigned int i = -1;</p>
<p>ist ok.</p>
<p>möchte ich aber als Fehler / Warnung vom Compiler.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2262178</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2262178</guid><dc:creator><![CDATA[offensiv]]></dc:creator><pubDate>Fri, 19 Oct 2012 19:57:25 GMT</pubDate></item><item><title><![CDATA[Reply to unsigned mit negativer zahl on Fri, 19 Oct 2012 20:37:22 GMT]]></title><description><![CDATA[<p>offensiv schrieb:</p>
<blockquote>
<p>hi, beschäftige mich gerade mit overflow / underflow bei Variablen.<br />
folgende Codezeile:</p>
<p>unsigned int i = -1;</p>
<p>ist ok.</p>
<p>möchte ich aber als Fehler / Warnung vom Compiler.</p>
</blockquote>
<p>Das gibt <strong>allerhöchstens</strong> ne Warnung, und das ist dann Compiler-Spezifisch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2262179</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2262179</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Fri, 19 Oct 2012 20:37:22 GMT</pubDate></item><item><title><![CDATA[Reply to unsigned mit negativer zahl on Fri, 19 Oct 2012 20:24:47 GMT]]></title><description><![CDATA[<p>-Wsign-conversion mit g++ oder clang++<br />
-Werror macht aus der Warnung einen Fehler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2262182</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2262182</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Fri, 19 Oct 2012 20:24:47 GMT</pubDate></item><item><title><![CDATA[Reply to unsigned mit negativer zahl on Sat, 20 Oct 2012 15:45:00 GMT]]></title><description><![CDATA[<p>Wozu diese Frage? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> Man hat 2 Möglichkeiten:<br />
1. nur positive Zahlen möglich, dann unsigned<br />
2. auch negative Zahlen möglich, dann int<br />
Was bitte sollen die Compilerbauer noch alles berücksichtigen, etwa dass auch double in Frage kommen soll?</p>
<pre><code class="language-cpp">unsigned i1, i2, i3, i4;
i1 = 1;
i2 = 5;
i3 = 2;
i4 = i1 - i2 / i3;  // -1.5
</code></pre>
<p>Der Programmierer soll und muss unsinnige Dinge des Anwenders abfangen. Ein Compiler muss aber nicht alles unsinnige des Proggers erkennen! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2262331</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2262331</guid><dc:creator><![CDATA[berniebutt]]></dc:creator><pubDate>Sat, 20 Oct 2012 15:45:00 GMT</pubDate></item><item><title><![CDATA[Reply to unsigned mit negativer zahl on Sat, 20 Oct 2012 15:53:25 GMT]]></title><description><![CDATA[<p>Sone schrieb:</p>
<blockquote>
<p>Das gibt <strong>allerhöchstens</strong> ne Warnung, und das ist dann Compiler-Spezifisch.</p>
</blockquote>
<p>Sicher? Ich dachte <code>unsigned</code> Über- und Unterläufe sind definiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2262334</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2262334</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sat, 20 Oct 2012 15:53:25 GMT</pubDate></item><item><title><![CDATA[Reply to unsigned mit negativer zahl on Sat, 20 Oct 2012 15:55:03 GMT]]></title><description><![CDATA[<p>out schrieb:</p>
<blockquote>
<p>Sone schrieb:</p>
<blockquote>
<p>Das gibt <strong>allerhöchstens</strong> ne Warnung, und das ist dann Compiler-Spezifisch.</p>
</blockquote>
<p>Sicher? Ich dachte <code>unsigned</code> Über- und Unterläufe sind definiert.</p>
</blockquote>
<p>Ja, sind sie. Warnen darf der Compiler, soviel er lustig ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2262336</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2262336</guid><dc:creator><![CDATA[SG1]]></dc:creator><pubDate>Sat, 20 Oct 2012 15:55:03 GMT</pubDate></item><item><title><![CDATA[Reply to unsigned mit negativer zahl on Sat, 20 Oct 2012 16:02:09 GMT]]></title><description><![CDATA[<p>SG1 schrieb:</p>
<blockquote>
<p>out schrieb:</p>
<blockquote>
<p>Sone schrieb:</p>
<blockquote>
<p>Das gibt <strong>allerhöchstens</strong> ne Warnung, und das ist dann Compiler-Spezifisch.</p>
</blockquote>
<p>Sicher? Ich dachte <code>unsigned</code> Über- und Unterläufe sind definiert.</p>
</blockquote>
<p>Ja, sind sie. Warnen darf der Compiler, soviel er lustig ist.</p>
</blockquote>
<p>Er warnt aber nicht, weil es zu einem Über- oder Unterlauf kommt, sondern weil es schlicht und einfach zu einem Informationsverlust kommt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2262338</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2262338</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sat, 20 Oct 2012 16:02:09 GMT</pubDate></item><item><title><![CDATA[Reply to unsigned mit negativer zahl on Sat, 20 Oct 2012 17:11:47 GMT]]></title><description><![CDATA[<p>out schrieb:</p>
<blockquote>
<p>SG1 schrieb:</p>
<blockquote>
<p>out schrieb:</p>
<blockquote>
<p>Sone schrieb:</p>
<blockquote>
<p>Das gibt <strong>allerhöchstens</strong> ne Warnung, und das ist dann Compiler-Spezifisch.</p>
</blockquote>
<p>Sicher? Ich dachte <code>unsigned</code> Über- und Unterläufe sind definiert.</p>
</blockquote>
<p>Ja, sind sie. Warnen darf der Compiler, soviel er lustig ist.</p>
</blockquote>
<p>Er warnt aber nicht, weil es zu einem Über- oder Unterlauf kommt, sondern weil es schlicht und einfach zu einem Informationsverlust kommt.</p>
</blockquote>
<p>Na und? Wieso und ob er warnt ist - wie gesagt - völlig seine Sache.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2262360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2262360</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sat, 20 Oct 2012 17:11:47 GMT</pubDate></item><item><title><![CDATA[Reply to unsigned mit negativer zahl on Sun, 21 Oct 2012 08:23:42 GMT]]></title><description><![CDATA[<p>Bei solchen Zuweisungen wird das letzte Bit gesetzt, heißt wenn man weiß, dass der User keine größere Zahl als 32***(Hab die genaue Zahl vergessen) eingibt, kann man einfach auf das letzte Bit testen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2262422</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2262422</guid><dc:creator><![CDATA[CTMN]]></dc:creator><pubDate>Sun, 21 Oct 2012 08:23:42 GMT</pubDate></item></channel></rss>