<?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[konvertierung ints]]></title><description><![CDATA[<p>wie siehts aus wenn man einen zu großen wert in einen kleinen datentypen casten will? oder einen mit vorzeichen? ist das ub / implementation defined / well formed?</p>
<pre><code>auto a = (std::uint32_t)~std::uint64_t();
auto b = (std::uint32_t)-1;
auto c = (std::uint32_t)std::numeric_limits&lt;std::int64_t&gt;::min();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/327405/konvertierung-ints</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Jul 2026 10:45:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/327405.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 09 Aug 2014 20:12:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to konvertierung ints on Sat, 09 Aug 2014 20:12:43 GMT]]></title><description><![CDATA[<p>wie siehts aus wenn man einen zu großen wert in einen kleinen datentypen casten will? oder einen mit vorzeichen? ist das ub / implementation defined / well formed?</p>
<pre><code>auto a = (std::uint32_t)~std::uint64_t();
auto b = (std::uint32_t)-1;
auto c = (std::uint32_t)std::numeric_limits&lt;std::int64_t&gt;::min();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2412750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2412750</guid><dc:creator><![CDATA[pedanterie überall]]></dc:creator><pubDate>Sat, 09 Aug 2014 20:12:43 GMT</pubDate></item><item><title><![CDATA[Reply to konvertierung ints on Sat, 09 Aug 2014 20:19:03 GMT]]></title><description><![CDATA[<p>für unsigned sind over- und underflow definiert.<br />
also 2. ist 100%ig well formed</p>
<p>1. auch well formed (~unit32_t)</p>
<p>3. impl. defined</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2412752</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2412752</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Sat, 09 Aug 2014 20:19:03 GMT</pubDate></item><item><title><![CDATA[Reply to konvertierung ints on Sat, 09 Aug 2014 20:27:33 GMT]]></title><description><![CDATA[<p>§4.7/2(/3) schrieb:</p>
<blockquote>
<p>If the destination type is unsigned, the resulting value is the least unsigned integer congruent to the source integer (modulo <span class="katex"><span class="katex-mathml"><math><semantics><mrow><msup><mn>2</mn><mi>n</mi></msup></mrow><annotation encoding="application/x-tex">2^n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.664392em;"></span><span class="strut bottom" style="height:0.664392em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord"><span class="mord mathrm">2</span><span class="vlist"><span style="top:-0.363em;margin-right:0.05em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord mathit">n</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span></span></span></span> where n is the number of bits used to represent the unsigned type). [...]<br />
If the destination type is signed, the value is unchanged if it can be represented in the destination type (and bit-field width); otherwise, the value is implementation-defined.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2412753</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2412753</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Sat, 09 Aug 2014 20:27:33 GMT</pubDate></item></channel></rss>