<?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>8-bit MicrocontrollersのトピックDeclaration type</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Declaration-type/m-p/187581#M14183</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand why theses following operations could be OK or NOK when i run program with simulator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void main()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;long number;&lt;/P&gt;&lt;P&gt;number = 1000*33; //The result is -32536&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void main()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;long number;&lt;/P&gt;&lt;P&gt;number = 1000*3.3*10; //The result is 33000&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any explanations? In fact i would like do a big operation what king of type number declaration i will use?&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;david&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Jun 2009 17:06:08 GMT</pubDate>
    <dc:creator>DavidoBG</dc:creator>
    <dc:date>2009-06-04T17:06:08Z</dc:date>
    <item>
      <title>Declaration type</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Declaration-type/m-p/187581#M14183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand why theses following operations could be OK or NOK when i run program with simulator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void main()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;long number;&lt;/P&gt;&lt;P&gt;number = 1000*33; //The result is -32536&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void main()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;long number;&lt;/P&gt;&lt;P&gt;number = 1000*3.3*10; //The result is 33000&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any explanations? In fact i would like do a big operation what king of type number declaration i will use?&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;david&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jun 2009 17:06:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Declaration-type/m-p/187581#M14183</guid>
      <dc:creator>DavidoBG</dc:creator>
      <dc:date>2009-06-04T17:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Declaration type</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Declaration-type/m-p/187582#M14184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to the standard an ANSI C compiler will evaluate expression like&amp;nbsp;&amp;nbsp;1000*33 on an int (16-bit) value and then result will be signed extended to long.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to tell the compiler the expression should be evaluated on 32-bit value.&lt;/P&gt;&lt;P&gt;In this purpose use the L prefix in one of the operant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your expression should be written 1000L * 33&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is compliant with ANSI C language definition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jun 2009 21:45:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Declaration-type/m-p/187582#M14184</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2009-06-04T21:45:17Z</dc:date>
    </item>
  </channel>
</rss>

