title: Why is this C macro causing syntax error?
body: <p>This is the first time I'm using macros in C and I'm trying to replace a large section of code that I'd normally place into a function with a macro. This is a part of an interrupt which will be used quite often and therefore I need to optimize it as much as I can. After reading the documentation, I've seen that the compiler doesn't support function inlining and I want to avoid the function call overhead.</p>
  
  <p>The code itself sends data to a serial-in parallel-out shift register and as far as I can see, there's no shorter way to write the piece of code I need.</p>
  
  <p>I'm using C18 compiler version 3.41 and MPLAB X IDE.</p>
  
  <p>So here's the code I'm using in function form:</p>
  
  <pre><code>void first_one(void)
  {
     //3 invisible zeroes
              LATBbits.LATB1=0; //data set to zero
  
              LATBbits.LATB0=1;//first clock
              LATBbits.LATB0=0;
  
              LATBbits.LATB0=1;//second clock
              LATBbits.LATB0=0;
  
              LATBbits.LATB0=1;//third clock
              LATBbits.LATB0=0;
              //end of invisible zeroes
  
              //two visible zeroes    
              LATBbits.LATB0=1;//first clock
              LATBbits.LATB0=0;
  
              LATBbits.LATB0=1;//second clock
              LATBbits.LATB0=0;
              //end of two visible zeroes
  
              LATBbits.LATB1=1;//Data is now one
  
              LATBbits.LATB0=1;
              LATBbits.LATB0=0;
              //one 
  
              LATBbits.LATB1=0;//Data is now zero
  
              LATBbits.LATB0=1;//first clock
              LATBbits.LATB0=0;
  
              LATBbits.LATB0=1;//second clock
              LATBbits.LATB0=0;
  
              //after this, everything should be in place
              LATBbits.LATB0=1;
              LATBbits.LATB0=0;
  }
  </code></pre>
  
  <p>I've turned the function into this macro:</p>
  
  <pre><code>#define first_one() {  \
  \
              LATBbits.LATB1=0;\               
                                \
              LATBbits.LATB0=1;\
              LATBbits.LATB0=0;\
                                  \
              LATBbits.LATB0=1;\
              LATBbits.LATB0=0;\
                              \
              LATBbits.LATB0=1;\
              LATBbits.LATB0=0;\
              \                                
              LATBbits.LATB0=1;\
              LATBbits.LATB0=0;\
  \
              LATBbits.LATB0=1;\
              LATBbits.LATB0=0;\
              \
              LATBbits.LATB1=1;\
  \
              LATBbits.LATB0=1;\
              LATBbits.LATB0=0;\    
  \
              LATBbits.LATB1=0;\
               ^^^ The syntax error is here!
  \
              LATBbits.LATB0=1;\
              LATBbits.LATB0=0;\
  \
              LATBbits.LATB0=1;\
              LATBbits.LATB0=0;\
  \
              LATBbits.LATB0=1;\
              LATBbits.LATB0=0;\
  \
                       }
  </code></pre>
  
  <p>So what am I doing wrong?</p>
  
  <p><strong>Update</strong>: I removed the comments and am now getting a syntax error in a different location.</p>