title: Macros to access identifiers with similar names
body: <p>Imagine you have many identifiers such as UARTxREG (where x is a number).</p>
  
  <p>Is there a way to write a macro such as:</p>
  
  <pre><code>#define CHANNEL_ONE 1
  #define UART_REG(channel)
  /* Later */
  UART_REG(CHANNEL_ONE) = 1;
  </code></pre>
  
  <p>So that this will expand to:</p>
  
  <pre><code>UART1REG
  </code></pre>
  
  <p>I can do this is a pass the literal numbers (1,2,3 etc..) into the macro but when I try to pass in a macro I get into the problem of the macro not expanding correctly.</p>
  
  <p>I currently have:</p>
  
  <pre><code>#define STRINGIFY(x) #x
  #define UART_REG(channel)            STRINGIFY(UART##channel##REG)
  /* Later */
  UART_REG(UART_ONE) = regVal;
  </code></pre>
  
  <p>However this is not expanding <code>channel</code>.</p>