title: C (Preprocessor): How to concatenate/append substitution string
body: <p>I define my exceptions on the command line:</p>
  
  <pre><code>-DEXCEPTION_1=\"first\" -DEXCEPTION_2=\"second\" -DEXCEPTION_3=\"third\"
  </code></pre>
  
  <p>which I check against a string:</p>
  
  <pre><code>except = 0;
  #ifdef EXCEPTION_1
  if (! strcmp(EXCEPTION_1, mystring))
  {  except = 1;
  }
  #endif
  #ifdef EXCEPTION_2
  if (! strcmp(EXCEPTION_2, mystring))
  {  except = 1;
  }
  #endif
  #ifdef EXCEPTION_3
  if (! strcmp(EXCEPTION_3, mystring))
  {  except = 1;
  }
  #endif
  if (except == 1)
  {  // do something
  }
  else
  {  // do something else
  }
  </code></pre>
  
  <p>Needless to say, while this works, it is also quite ugly, inflexible and causes redundancy in my code.</p>
  
  <p>Is there a way to append a string to a preprocessor macro variable?</p>
  
  <p>I would like to get something like this (the problem of course is that <code>#append</code> does not exist):</p>
  
  <pre><code>#ifdef EXCEPTION_1 #append EXCEPTIONS if (! strcmp(EXCEPTION_1, mystring)) {  except = 1; }
  #ifdef EXCEPTION_2 #append EXCEPTIONS if (! strcmp(EXCEPTION_2, mystring)) {  except = 1; }
  #ifdef EXCEPTION_3 #append EXCEPTIONS if (! strcmp(EXCEPTION_3, mystring)) {  except = 1; }
  </code></pre>
  
  <p>Then I could just use <code>EXCEPTIONS</code> in the code and it would work with all possible permutations of exceptions.</p>
  
  <p>In other words I want to append a string to a macro variable - is it possible?</p>