title: How to concatenate strings with C preprocessor with dots in them?
body: <p>I've read the following question and the answer seems clear enough:
  <a href="https://stackoverflow.com/questions/1489932/c-preprocessor-and-concatenation">How to concatenate twice with the C preprocessor and expand a macro as in &quot;arg ## _ ## MACRO&quot;?</a></p>
  
  <p>But what if VARIABLE has a dot at the end?</p>
  
  <p>I'm trying to do a simple macro that increments counters in a struct for debugging purposes. I can easily do this even without the help from the above question simply with</p>
  
  <pre><code>#ifdef DEBUG
  #define DEBUG_INC_COUNTER(x) x++
  #endif
  </code></pre>
  
  <p>and call it</p>
  
  <pre><code>DEBUG_INC_COUNT(debugObj.var1);
  </code></pre>
  
  <p>But adding "debugObj." to every macro seems awfully redundant. However if I try to concatenate:</p>
  
  <pre><code>#define VARIABLE debugObj.
  #define PASTER(x,y) x ## y++
  #define EVALUATOR(x,y)  PASTER(x,y)
  #define DEBUG_INC_COUNTER(x) EVALUATOR(VARIABLE, x)
  DEBUG_INC_COUNTER(var)
  
  gcc -E macro.c
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>macro.c:6:1: error: pasting "." and "var" does not give a valid preprocessing token
  </code></pre>
  
  <p>So how should I change this so that </p>
  
  <pre><code>DEBUG_INC_COUNTER(var);
  </code></pre>
  
  <p>generates</p>
  
  <pre><code>debugObj.var++;
  </code></pre>
  
  <p>?</p>