title: C Macros - avoiding macro expansion
body: <p>I have the following macros  </p>
  
  <pre><code>#define REG_PWR_CTRL 0x2D  
  #define REG_FIFO_CTL 0x38
  
  #define VERBOSE(...) \
      if(verbose) \
              printf(__VA_ARGS__);
  
  #define READ_REGISTER(i2c_dev_file, REGISTER, variable) \
  { \
      variable = i2c_smbus_read_byte_data(i2c_dev_file, REGISTER); \
  }
  
  #define WRITE_REGISTER_VERBOSE(i2c_dev_file, REGISTER, value) \
  { \
      short int var = 0; \
      i2c_smbus_write_byte_data(i2c_dev_file, REGISTER, value); \
      usleep(100); \
      READ_REGISTER(i2c_dev_file, REGISTER, var); \
      VERBOSE(#REGISTER "    :0x%02X\n", var); \
  }
  </code></pre>
  
  <p>I would like the <code>REGISTER</code> field to not be expanded in the following line<br>
  <code>VERBOSE(#REGISTER "    :0x%02X\n", var); \</code>  </p>
  
  <p>For example, When I write<br>
  <code>WRITE_REGISTER_VERBOSE(i2c_dev_fd, REG_PWR_CTRL, 0x1A);</code><br>
    <code>WRITE_REGISTER_VERBOSE(i2c_dev_fd, REG_FIFO_CTL, 0xC6);</code><br>
  I get the output<br>
  <code>0x2D    :0x1A</code><br>
  <code>0x38    :0xC6</code><br>
  I would like to obtain<br>
  <code>REG_PWR_CTRL    :0x1A</code><br>
  <code>REG_FIFO_CTL    :0xC6</code>  </p>
  
  <p>I came across a lot of posts that spoke about adding an extra level of indirection.<br>
  I tried the answer described here <a href="https://stackoverflow.com/a/2653351/1761555">https://stackoverflow.com/a/2653351/1761555</a> ..although I believe that that answer is for a different problem altogether..</p>
  
  <p>What I did was  </p>
  
  <pre><code>#define STRINGIFY(label) (#label)
  
  #define WRITE_REGISTER_VERBOSE(i2c_dev_file, REGISTER, value) \
  { \
      short int var = 0; \
      i2c_smbus_write_byte_data(i2c_dev_file, REGISTER, value); \
      usleep(100); \
      READ_REGISTER(i2c_dev_file, REGISTER, var); \
      VERBOSE("%s    :0x%02X\n", STRINGIFY(REGISTER), var); \
  }
  </code></pre>
  
  <p>But this still gives me the same output as before  </p>
  
  <p>Is there any way to achieve this?</p>