<?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のトピックRe: enum identifiers in a switch case</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128269#M1609</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;As an aside for maximum efficiency, remember that underlying data type for an enum&amp;nbsp;is an int, for which the compiler might generate 16-bit signed code, which can be inefficient for 8-bit micros.&amp;nbsp; If you have only a few elements you might be better off just making a bunch of #define's and assigning them to a uchar.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;-Tomahawk&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Aug 2006 22:03:43 GMT</pubDate>
    <dc:creator>admin</dc:creator>
    <dc:date>2006-08-28T22:03:43Z</dc:date>
    <item>
      <title>enum identifiers in a switch case</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128265#M1605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;the case of a switch expression having an enum type and the case expressions include the identifiers which are looked up as enum constants in the enum type does not build proper.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;produces and error c1815 &amp;amp; c1845.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//from three different files code segmants&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;my_varriable.c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;enum myenum {xx,yy,zz} MyEnum;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;my_varriable.h&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;extern enum myenum MyEnum;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;main.c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#include my_varriable.h&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;switch(MyEnum){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; case xx:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; case yy:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; case zz:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; };&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Aug 2006 02:11:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128265#M1605</guid>
      <dc:creator>jah</dc:creator>
      <dc:date>2006-08-26T02:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: enum identifiers in a switch case</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128266#M1606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;HI:&lt;BR /&gt;&lt;BR /&gt;I think you cannot used the 'MyEnum' identifier as the switch variable, because it is the enum type name. You need to create another variable and assign it the enum constant that you want to process with yout switch statement.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Alex&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Aug 2006 02:15:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128266#M1606</guid>
      <dc:creator>alex_spotw</dc:creator>
      <dc:date>2006-08-26T02:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: enum identifiers in a switch case</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128267#M1607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;C is case sensative, hterefor the statement enum myenum MyEnum is functional. anyways in the actual code the actual varriables are not anything myenum / MyEnum&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Aug 2006 02:48:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128267#M1607</guid>
      <dc:creator>jah</dc:creator>
      <dc:date>2006-08-26T02:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: enum identifiers in a switch case</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128268#M1608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I guess the problem is that the xx,yy &amp;amp; zz identifiers are not visible in main.c.&lt;BR /&gt;I would propose to move the enum type definition into the header file.&lt;BR /&gt;&lt;BR /&gt;my_varriable.c&lt;BR /&gt;#include "my_varriable.h"&lt;BR /&gt;myenumType MyEnum;&lt;BR /&gt;&lt;BR /&gt;my_varriable.h&lt;BR /&gt;#ifndef MY_VARIABLE_H_&lt;BR /&gt;#define MY_VARIABLE_H_&lt;BR /&gt;typedef enum {xx,yy,zz} myenumType;&lt;BR /&gt;extern myenumType MyEnum;&lt;BR /&gt;#endif /* MY_VARIABLE_H_ */&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Aug 2006 01:56:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128268#M1608</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2006-08-28T01:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: enum identifiers in a switch case</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128269#M1609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;As an aside for maximum efficiency, remember that underlying data type for an enum&amp;nbsp;is an int, for which the compiler might generate 16-bit signed code, which can be inefficient for 8-bit micros.&amp;nbsp; If you have only a few elements you might be better off just making a bunch of #define's and assigning them to a uchar.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;-Tomahawk&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Aug 2006 22:03:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128269#M1609</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2006-08-28T22:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: enum identifiers in a switch case</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128270#M1610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;Or if you are using CodeWarrior Compiler tell it to use 8-bits to encode enums &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 15:44:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128270#M1610</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-08-29T15:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: enum identifiers in a switch case</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128271#M1611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;"use CodeWarrior Compiler tell it to use 8-bits to encode enums"&lt;BR /&gt;thanks CrasyCat&lt;BR /&gt;&lt;BR /&gt;this sounds interesting, where is the setting to do this??&lt;BR /&gt;&lt;BR /&gt;THANKS!&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 17:55:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128271#M1611</guid>
      <dc:creator>jah</dc:creator>
      <dc:date>2006-08-29T17:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: enum identifiers in a switch case</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128272#M1612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;If you are using the IDE to build the application:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Open the project&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Open the target setting dialog (Press ALT+F7)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - switch to the "Compiler for HC08" Panel&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Click on the "Type Sizes" button.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - In the "Standard Types Setting" dialog set enum to 8-bit using the radio button&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Close the dialog with OK&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Close target setting dialog with OK.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you are building from batch (or from am make file) add option -TE1 to your command line.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Note that you can also set enum type to be unsigned per default. The option for 8-bit unsigned enums is&lt;/DIV&gt;&lt;DIV&gt;-TE1uE&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 18:23:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128272#M1612</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-08-29T18:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: enum identifiers in a switch case</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128273#M1613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;HR /&gt;CrasyCat wrote:&lt;BR /&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;If you are using the IDE to build the application:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Open the project&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Open the target setting dialog (Press ALT+F7)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - switch to the "Compiler for HC08" Panel&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Click on the "Type Sizes" button.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - In the "Standard Types Setting" dialog set enum to 8-bit using the radio button&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Close the dialog with OK&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Close target setting dialog with OK.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you are building from batch (or from am make file) add option -TE1 to your command line.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Note that you can also set enum type to be unsigned per default. The option for 8-bit unsigned enums is&lt;/DIV&gt;&lt;DIV&gt;-TE1uE&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;DIV&gt;Crasy,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That just earned you a 5-star post rating.&amp;nbsp; &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;-Tomahawk&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 19:30:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128273#M1613</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2006-08-29T19:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: enum identifiers in a switch case</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128274#M1614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;THANKS: alex_spotw, Tomahawk, CrasyCat, CompilerGuru, EVERYONE!!&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 21:16:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/enum-identifiers-in-a-switch-case/m-p/128274#M1614</guid>
      <dc:creator>jah</dc:creator>
      <dc:date>2006-08-29T21:16:27Z</dc:date>
    </item>
  </channel>
</rss>

