<?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[Suppression of Implicit Conversion warnings]]></title><description><![CDATA[<p dir="auto">I am running the current version of QtCreator on a Mac with the current version of Xcode.</p>
<p dir="auto">When I compile a program with the following line,</p>
<pre><code> int x = round(1.1);
</code></pre>
<p dir="auto">I receive a warning that states:</p>
<p dir="auto">"implicit conversion turns floating-point number to integer; 'double' to 'int'"</p>
<p dir="auto">How may I suppress such warnings?</p>
<p dir="auto">Thank you.</p>
<p dir="auto">Hoyt</p>
]]></description><link>https://forum.qt.io/topic/93152/suppression-of-implicit-conversion-warnings</link><generator>RSS for Node</generator><lastBuildDate>Thu, 10 Sep 2026 07:03:56 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/93152.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 29 Jul 2018 22:26:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Suppression of Implicit Conversion warnings on Mon, 30 Jul 2018 08:00:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hoyt">@<bdi>Hoyt</bdi></a><br />
you should combine <code>static_cast&lt;int&gt;</code> and round, otherwise you'll run into floating point issues. Remember:</p>
<pre><code>static_cast&lt;int&gt;(0.8 * 10) = 7  //!!! 
</code></pre>
<pre><code>int i = static_cast&lt;int&gt;(round(value));
</code></pre>
]]></description><link>https://forum.qt.io/post/472710</link><guid isPermaLink="true">https://forum.qt.io/post/472710</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Mon, 30 Jul 2018 08:00:16 GMT</pubDate></item><item><title><![CDATA[Reply to Suppression of Implicit Conversion warnings on Mon, 30 Jul 2018 07:46:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hoyt">@<bdi>Hoyt</bdi></a><br />
Hi<br />
Ok which complication ?<br />
(just to know)<br />
yes, you can cast it and it should accept that.<br />
I just thought you wanted to round the value not cap it.<br />
so 1.0 and 1.9 both be 1.</p>
]]></description><link>https://forum.qt.io/post/472709</link><guid isPermaLink="true">https://forum.qt.io/post/472709</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Mon, 30 Jul 2018 07:46:56 GMT</pubDate></item><item><title><![CDATA[Reply to Suppression of Implicit Conversion warnings on Mon, 30 Jul 2018 00:19:13 GMT]]></title><description><![CDATA[<p dir="auto">mrjj,</p>
<p dir="auto">I receive another implicit conversion with std::lround()</p>
<p dir="auto">I can solve the problem by using static_cast&lt;int&gt; .  I guess that I will utilize casting to eliminate the warnings.</p>
<p dir="auto">Hoyt</p>
]]></description><link>https://forum.qt.io/post/472675</link><guid isPermaLink="true">https://forum.qt.io/post/472675</guid><dc:creator><![CDATA[Hoyt]]></dc:creator><pubDate>Mon, 30 Jul 2018 00:19:13 GMT</pubDate></item><item><title><![CDATA[Reply to Suppression of Implicit Conversion warnings on Sun, 29 Jul 2018 23:07:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hoyt">@<bdi>Hoyt</bdi></a><br />
Hi<br />
Why not use<br />
std::lround();  ( Lround)<br />
If you want to round to nearest int.</p>
<p dir="auto">Google says you can hide these warnings you can switch “implicit conversion to 32 bit type” to no in your build settings. Might only affect other converts and not double to int truncating.<br />
Not that i recommend it as it will also hide the cases where it does matter :)</p>
]]></description><link>https://forum.qt.io/post/472668</link><guid isPermaLink="true">https://forum.qt.io/post/472668</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Sun, 29 Jul 2018 23:07:39 GMT</pubDate></item><item><title><![CDATA[Reply to Suppression of Implicit Conversion warnings on Sun, 29 Jul 2018 22:47:39 GMT]]></title><description><![CDATA[<p dir="auto">SGaist,</p>
<p dir="auto">The line</p>
<pre><code> x = std::rint(1.1);
</code></pre>
<p dir="auto">generates the same warning.</p>
<pre><code> "implicit conversion turns floating-point number into integer: 'double' to 'int'"
</code></pre>
<p dir="auto">I would like to turn off all "implicit conversion" warnings.</p>
<p dir="auto">Hoyt</p>
]]></description><link>https://forum.qt.io/post/472667</link><guid isPermaLink="true">https://forum.qt.io/post/472667</guid><dc:creator><![CDATA[Hoyt]]></dc:creator><pubDate>Sun, 29 Jul 2018 22:47:39 GMT</pubDate></item><item><title><![CDATA[Reply to Suppression of Implicit Conversion warnings on Sun, 29 Jul 2018 22:43:35 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">What about using <code>std::rint</code> ?</p>
]]></description><link>https://forum.qt.io/post/472666</link><guid isPermaLink="true">https://forum.qt.io/post/472666</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sun, 29 Jul 2018 22:43:35 GMT</pubDate></item></channel></rss>