<?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>topic Re: Mulitple Line Macros in Codewarrior in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Mulitple-Line-Macros-in-Codewarrior/m-p/212752#M18337</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe a space problem?&lt;/P&gt;&lt;P&gt;The initial line in the initial post has some spaces after the backward slash character:&lt;/P&gt;&lt;P&gt;With quotes around the string:&lt;/P&gt;&lt;P&gt;"#define PACK8(x,y)&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; \&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The \ must be the last character on the line, if it is followed by a space then the slash just escapes the space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For such errors I would always have a look at the preprocessor output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Sep 2009 10:45:32 GMT</pubDate>
    <dc:creator>CompilerGuru</dc:creator>
    <dc:date>2009-09-02T10:45:32Z</dc:date>
    <item>
      <title>Mulitple Line Macros in Codewarrior</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Mulitple-Line-Macros-in-Codewarrior/m-p/212749#M18334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Everytime that I try to compile my code with multiple line macros I get an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error&amp;nbsp; :&amp;nbsp; C2450: Expected:&amp;nbsp; ~(IDENT auto const extern registrar static typedef volatile __interrupt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code that it is refering to is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#define PACK8(x,y)&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; \&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; \&lt;BR /&gt;&amp;nbsp; CLEAR8(0, x, 0xff);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; \&lt;BR /&gt;&amp;nbsp; PUT8(0, x, y, 0xff);&amp;nbsp;&amp;nbsp;&amp;nbsp; \&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used this same syntax in many other compilers, but I can not get it to compile in Codewarrior for Microcontrollers V6.2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would greatly appreciate any advice.&amp;nbsp; Due to the nature of the code, changing these macros to single line ones would not be a desirable solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2009 19:59:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Mulitple-Line-Macros-in-Codewarrior/m-p/212749#M18334</guid>
      <dc:creator>aergin</dc:creator>
      <dc:date>2009-09-01T19:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Mulitple Line Macros in Codewarrior</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Mulitple-Line-Macros-in-Codewarrior/m-p/212750#M18335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;It would seem that the compiler expects something on the same row as the #define. This seems to solve the problem:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;#define PACK8(x,y) { \
  CLEAR8(0, x, 0xff);     \
  PUT8(0, x, y, 0xff);    \
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;What the C standard says, I have no idea.&lt;BR /&gt;&lt;BR /&gt;However, why not write a real function instead? Most modern compilers, including CW, supports inlining, so there is never a reason to use function-like macros.&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by Lundin on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-09-01&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;03:59 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2009 20:58:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Mulitple-Line-Macros-in-Codewarrior/m-p/212750#M18335</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2009-09-01T20:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Mulitple Line Macros in Codewarrior</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Mulitple-Line-Macros-in-Codewarrior/m-p/212751#M18336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks for the reply.&amp;nbsp; I do agree that there are better ways to write it.&amp;nbsp; The problem is, I am locked into auto generated code that comes out in the form I posted.&amp;nbsp; It is strange that the compiler has a problem with it.&amp;nbsp; I have been checking to see if I can find a flag or any other setting that will let it go as is.&amp;nbsp; If I have to manually change all the auto generated code, it could take a long time and then it would have to be redone on regeneation.&amp;nbsp;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2009 00:36:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Mulitple-Line-Macros-in-Codewarrior/m-p/212751#M18336</guid>
      <dc:creator>aergin</dc:creator>
      <dc:date>2009-09-02T00:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: Mulitple Line Macros in Codewarrior</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Mulitple-Line-Macros-in-Codewarrior/m-p/212752#M18337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe a space problem?&lt;/P&gt;&lt;P&gt;The initial line in the initial post has some spaces after the backward slash character:&lt;/P&gt;&lt;P&gt;With quotes around the string:&lt;/P&gt;&lt;P&gt;"#define PACK8(x,y)&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; \&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The \ must be the last character on the line, if it is followed by a space then the slash just escapes the space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For such errors I would always have a look at the preprocessor output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2009 10:45:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Mulitple-Line-Macros-in-Codewarrior/m-p/212752#M18337</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2009-09-02T10:45:32Z</dc:date>
    </item>
  </channel>
</rss>

