<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code import help please</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/21758/code-import-help-please</link><description> 
Hi I am new to C and am trying to convert some C code into the
Keil dialect. Mostly successful, but have got really stuck on the
following fragment. I get the error as shown. After hours of playing
with variations I just can&amp;#39;t work it out. Would some</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Code import help please</title><link>https://community.arm.com/thread/49282?ContentTypeID=1</link><pubDate>Thu, 17 Jan 2008 13:07:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:19241c6e-92d2-4fc5-8b7f-e23c91fcd0f7</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;convert some C code into the Keil dialect.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Actually, no. You&amp;#39;re trying to convert some other compiler&amp;#39;s
dialect back into something closer to standard C. The dialect issue
at hand is an anonymous union member in a struct. Standard C doesn&amp;#39;t
allow that, but some compilers do.&lt;/p&gt;

&lt;p&gt;
This will be tedious to fix. You&amp;#39;ll have to name the union
element, and change each and every access to it to include the
union&amp;#39;s own name.&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;get the error as shown.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
No. What you show is a warning, not an error.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Code import help please</title><link>https://community.arm.com/thread/49281?ContentTypeID=1</link><pubDate>Thu, 17 Jan 2008 11:53:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3fec4a29-49f3-4252-af39-6053a2fd585d</guid><dc:creator>Gp F</dc:creator><description>&lt;p&gt;&lt;p&gt;
This should do the trick:&lt;/p&gt;

&lt;pre&gt;
typedef struct  {
  char apiId;
  union  {
    char payload[ 100 ];
    XB_TX64 tx64;
    XB_TX16 tx16;
    XB_TXStatus txStatus;
    XB_RX64 rx64;
    XB_RX16 rx16;
    XB_ATCommand atCommand;
    XB_ATCommandResponse atResponse;
    XB_IO64 io64;
    XB_IO16 io16;
  } &lt;b&gt;__attribute((packed)) variants;&lt;/b&gt;
  char crc;
  char *dataPtr;
  int rxState;
  int length;
  int index;
 } __attribute((packed)) XBPacket;
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>