<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>ColdFire/68K Microcontrollers and Processorsのトピックimpicit arithmetic conversion warnings</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/impicit-arithmetic-conversion-warnings/m-p/172801#M6517</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Using CW 6.1 compiling for ColdFire V1 of a project that was converted from HCS08 QE128 project.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why does the following generate warning:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;implicit arithmetic conversion from 'int' to 'unsigned short'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;typedef unsigned short uint16_t&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;typedef uint16_t SystemTime_t&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SystemTime_t&amp;nbsp;&amp;nbsp; systemTimeMs;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;inline static SystemTime_t ElapsedTime(SystemTime_t startTime)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return systemTimeMs - startTime;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it seems to me that all the parameters are clearly defined as 'unsigned short' and there should be no implicit conversions going on?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Dec 2007 02:59:20 GMT</pubDate>
    <dc:creator>WayneS</dc:creator>
    <dc:date>2007-12-14T02:59:20Z</dc:date>
    <item>
      <title>impicit arithmetic conversion warnings</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/impicit-arithmetic-conversion-warnings/m-p/172801#M6517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Using CW 6.1 compiling for ColdFire V1 of a project that was converted from HCS08 QE128 project.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why does the following generate warning:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;implicit arithmetic conversion from 'int' to 'unsigned short'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;typedef unsigned short uint16_t&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;typedef uint16_t SystemTime_t&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SystemTime_t&amp;nbsp;&amp;nbsp; systemTimeMs;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;inline static SystemTime_t ElapsedTime(SystemTime_t startTime)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return systemTimeMs - startTime;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it seems to me that all the parameters are clearly defined as 'unsigned short' and there should be no implicit conversions going on?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2007 02:59:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/impicit-arithmetic-conversion-warnings/m-p/172801#M6517</guid>
      <dc:creator>WayneS</dc:creator>
      <dc:date>2007-12-14T02:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: impicit arithmetic conversion warnings</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/impicit-arithmetic-conversion-warnings/m-p/172802#M6518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BR /&gt;In C, every operation is perfomed with at least int, even if all the operands have a smaller type.&lt;BR /&gt;Ask google for "Usual Arithmetic Conversions" for details.&lt;BR /&gt;The compiler is right that (unsigned short)-(unsigned short) is a int for the Coldfire processor.&lt;BR /&gt;For the HC08, as the unsigned short has the same size as int, the result it a unsigned int.&lt;BR /&gt;I guess because short and int have the same size, the HC08 compiler did not issue a warning, but for the CF compiler it makes sence to issue it.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2007 03:29:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/impicit-arithmetic-conversion-warnings/m-p/172802#M6518</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2007-12-14T03:29:23Z</dc:date>
    </item>
  </channel>
</rss>

